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:
spencerrlongg 2024-11-20 16:42:56 -06:00
parent 6ddaa0bb3e
commit 10126b8362
2 changed files with 3 additions and 2 deletions

View file

@ -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) {

View file

@ -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>