bound('sentry') && $this->shouldReport($exception)) { app('sentry')->captureException($exception); } parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Throwable $exception * @return \Illuminate\Http\Response */ public function render($request, Throwable $exception) { if ($exception instanceof ValidationErrorException) { return response()->json(Responser::error($exception->getMessageBody(), $exception->getMessageInfo()), 422); } elseif ($exception instanceof SiteBannedException) { return response()->view('webBuilder::errors.template_disabled', ['error' => 'business banned']); } elseif ($exception instanceof HasRelationException) { return response()->json(Responser::error([$exception->getMessage()]), 422); } elseif ($this->isHttpException($exception)) { if ($exception->getStatusCode() == 404 and in_array("web",$request->route()->middleware())) { return response()->view('webBuilder::errors.404', [], 404); } } return parent::render($request, $exception); } }