*/ protected $dontFlash = [ 'current_password', 'password', 'password_confirmation', ]; /** * Register the exception handling callbacks for the application. */ public function register(): void { $this->reportable(function (Throwable $e) { // }); } public function render($request, Throwable $e) { \Illuminate\Support\Facades\Log::info('Handler render called', ['inertia' => $request->inertia(), 'exception' => get_class($e)]); if ($request->inertia()) { if ($e instanceof ValidationException) { \Illuminate\Support\Facades\Log::info('ValidationException in Inertia', ['errors' => $e->errors()]); return response()->json([ 'message' => 'The given data was invalid.', 'errors' => $e->errors(), ], 422)->header('X-Inertia-Error', 'true'); } if ($e instanceof \Exception) { \Illuminate\Support\Facades\Log::info('Exception in Inertia', ['message' => $e->getMessage()]); return response()->json([ 'message' => 'Registrierung fehlgeschlagen.', 'errors' => ['general' => $e->getMessage()], ], 500)->header('X-Inertia-Error', 'true'); } } return parent::render($request, $e); } }