add error handler of rendering exceptions in brief
This commit is contained in:
parent
04de047b8a
commit
043dabaccf
|
|
@ -72,17 +72,18 @@ class Handler extends ExceptionHandler
|
|||
return $e->getResponse()->setStatusCode(200);
|
||||
}
|
||||
|
||||
// render exceptions with whoops
|
||||
if (config('app.debug')) {
|
||||
foreach ($this->dontReport as $type) {
|
||||
if ($e instanceof $type) {
|
||||
return parent::render($request, $e);
|
||||
foreach ($this->dontReport as $type) {
|
||||
if ($e instanceof $type) {
|
||||
return parent::render($request, $e);
|
||||
} else {
|
||||
// hide exception details if not in debug mode
|
||||
if (config('app.debug')) {
|
||||
return $this->renderExceptionWithWhoops($e);
|
||||
} else {
|
||||
return $this->renderExceptionInBrief($e);
|
||||
}
|
||||
}
|
||||
return $this->renderExceptionWithWhoops($e);
|
||||
}
|
||||
|
||||
return response()->view('errors.brief', ['code' => 0, 'message' => 'cmn']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -104,4 +105,15 @@ class Handler extends ExceptionHandler
|
|||
$e->getHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception in a short word.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function renderExceptionInBrief(Exception $e)
|
||||
{
|
||||
return response()->view('errors.brief');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user