mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix error handling in BulkAssetsController
Updated exception handling to capture detailed validation errors in BulkAssetsController. Corrected formatting in notifications view for displaying error messages.
This commit is contained in:
parent
6ddaa0bb3e
commit
10126b8362
|
@ -243,7 +243,7 @@ class BulkAssetsController extends Controller
|
||||||
);
|
);
|
||||||
// catch exceptions
|
// catch exceptions
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
$errors[$key] = $e->getMessage();
|
$errors = $e->validator->errors()->toArray();
|
||||||
} catch (CustomFieldPermissionException $e) {
|
} catch (CustomFieldPermissionException $e) {
|
||||||
//$errors[$key] = $e->getMessage();
|
//$errors[$key] = $e->getMessage();
|
||||||
$custom_field_problem = true;
|
$custom_field_problem = true;
|
||||||
|
@ -253,6 +253,7 @@ class BulkAssetsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($errors)) {
|
if (!empty($errors)) {
|
||||||
|
//dump($errors);
|
||||||
return redirect($bulk_back_url)->with('bulk_asset_errors', $errors);
|
return redirect($bulk_back_url)->with('bulk_asset_errors', $errors);
|
||||||
}
|
}
|
||||||
if ($custom_field_problem) {
|
if ($custom_field_problem) {
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
<i class="fas fa-exclamation-triangle faa-pulse animated"></i>
|
<i class="fas fa-exclamation-triangle faa-pulse animated"></i>
|
||||||
<strong>{{ trans('general.notification_error') }}: </strong>
|
<strong>{{ trans('general.notification_error') }}: </strong>
|
||||||
{{ trans('general.notification_bulk_error_hint') }}
|
{{ trans('general.notification_bulk_error_hint') }}
|
||||||
@foreach($messages as $key => $message)
|
@foreach($messages as $key => $message)
|
||||||
@for ($x = 0; $x < count($message); $x++)
|
@for ($x = 0; $x < count($message); $x++)
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{ $message[$x] }}</li>
|
<li>{{ $message[$x] }}</li>
|
||||||
|
|
Loading…
Reference in a new issue