flash('error', $e->message); return redirect($e->redirectLocation); } // Handle pretty exceptions which will show a friendly application-fitting page // Which will include the basic message to point the user roughly to the cause. if (($e instanceof PrettyException || $e->getPrevious() instanceof PrettyException) && !config('app.debug')) { $message = ($e instanceof PrettyException) ? $e->getMessage() : $e->getPrevious()->getMessage(); $code = ($e->getCode() === 0) ? 500 : $e->getCode(); return response()->view('errors/' . $code, ['message' => $message], $code); } return parent::render($request, $e); } }