/** * @param RequestInterface $request * @param \Closure $next * @return ResponseInterface */ public function handle(RequestInterface $request, \Closure $next) : ResponseInterface { try { return $next($request); } catch (\Throwable $e) { $this->run->allowQuit(false); $this->run->sendHttpCode(false); $this->run->writeToOutput(false); return $this->responseFactory->createResponse($e->getCode() >= 400 ? $e->getCode() : 500)->append($this->run->handleException($e)); } }
/** * Pushing default error handlers * * @param RunInterface $run * @return void */ public function errors(RunInterface $run) { $run->pushHandler($this->container->get(ErrorHandlerLogger::class)); }
public function disable() { $this->whoops->unregister(); }