/** * @param Exception $exception */ protected function writeException(\Exception $exception) { $whoopsInspector = new WhoopsInspector($exception); $this->whoopsHandler->setInspector($whoopsInspector); $this->whoopsHandler->setException($exception); $this->whoopsHandler->setRun(new WhoopsRun()); $whoopsHandleResponse = $this->whoopsHandler->handle(); $this->processWhoopsBubbling($whoopsHandleResponse); }
/** * @param ContainerInterface $application * @throws \InvalidArgumentException */ public function register(ContainerInterface $application) { $this->app = $application; /** * register whoops when debug mode enabled */ $this->app->singleton([ErrorHandler::class => 'ErrorHandler'], function () { if ($this->errorHandler instanceof PrettyPageHandler) { $this->errorHandler->handleUnconditionally(true); } $this->whoops = new Run(); $this->whoops->allowQuit(false); $this->whoops->pushHandler($this->errorHandler); return new ErrorHandler($this->app, $this->whoops, $this->contentType); }); /** * catch fatal error */ register_shutdown_function([$this->app['ErrorHandler'], 'handleError']); }