<?phpnamespace App\Exceptions;use Exception;use Illuminate\Database\Eloquent\ModelNotFoundException;use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;use ModStart\Core\Exception\BizException;use ModStart\Core\Exception\ExceptionReportHandleTrait;use Symfony\Component\HttpKernel\Exception\HttpException;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;class Handler extends ExceptionHandler{use ExceptionReportHandleTrait;/*** A list of the exception types that should not be reported.** @var array*/protected $dontReport = [HttpException::class,ModelNotFoundException::class,BizException::class,];/*** Report or log an exception.** This is a great spot to send exceptions to Sentry, Bugsnag, etc.** @param \Exception $exception* @return void*/public function report(Exception $exception){$this->errorReportCheck($exception);parent::report($exception);}/*** Render an exception into an HTTP response.** @param \Illuminate\Http\Request $request* @param \Exception $e* @return \Illuminate\Http\Response*/public function render($request, Exception $e){if ($e instanceof ModelNotFoundException) {$e = new NotFoundHttpException($e->getMessage(), $e);}$t = $this->getExceptionResponse($e);if (null !== $t) {return $t;}return parent::render($request, $e);}/*** Convert the given exception into a Response instance.** @param \Exception $e** @return \Symfony\Component\HttpFoundation\Response*/protected function convertExceptionToResponse(Exception $e){$t = $this->getExceptionResponse($e);if (null !== $t) {return $t;}if (config('env.APP_DEBUG', true)) {return parent::convertExceptionToResponse($e);}return response()->view('errors.500', ['exception' => $e], 500);}protected function shouldntReport(\Exception $e){return $this->isExceptionIgnore($e) || parent::shouldntReport($e);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型