|
47 | 47 | ]; |
48 | 48 |
|
49 | 49 | if (in_array($statusCode, [500, 503, 404, 403])) { |
50 | | - if (!$request->inertia()) { |
| 50 | + if ( |
| 51 | + $statusCode === 500 |
| 52 | + && app()->hasDebugModeEnabled() |
| 53 | + && get_class($exception) !== ErrorToastException::class |
| 54 | + ) { |
| 55 | + return $response; |
| 56 | + } elseif (!$request->inertia()) { |
51 | 57 | // Show error page component for standard visits |
52 | 58 | return Inertia::render('Error', [ |
53 | 59 | 'errorTitles' => $errorTitles, |
|
62 | 68 | ->toResponse($request) |
63 | 69 | ->setStatusCode($statusCode); |
64 | 70 | } else { |
65 | | - // Show standard modal for easier debugging locally |
66 | | - if (app()->hasDebugModeEnabled() && $statusCode === 500) { |
67 | | - return $response; |
68 | | - } |
69 | 71 | // Return JSON response for PrimeVue toast to display, handled by Inertia router event listener |
70 | 72 | $errorSummary = "$statusCode - $errorTitles[$statusCode]"; |
71 | 73 | $errorDetail = $errorDetails[$statusCode]; |
|
0 commit comments