getMessage(), $e); } if ($request->isXmlHttpRequest() || $request->ajax() || $request->is('remote/*')) { $exception = 'An exception occured while attempting to perform this action, please try again.'; if ($e instanceof DisplayException) { $exception = $e->getMessage(); } // Live environment, just return a nice error. if(!env('APP_DEBUG', false)) { return response()->json([ 'error' => $exception ], 500); } // If we are debugging, return the exception in it's full manner. return response()->json([ 'error' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine() ], 500); } return parent::render($request, $e); } }