Laravel 5.2 Whoops 디버그 패키지 사용하기
Laravel 4 에서 볼 수 있었던 Whoops 를 Laravel 5 에서 사용하기 위하여 아래의 composer 패키지를 추가합니다.
filp/whoops
app\Exceptions\Handler.php 를 아래와 같이 수정합니다.
protected function renderExceptionWithWhoops(Exception $e)
{
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
return new \Illuminate\Http\Response(
$whoops->handleException($e),
$e->getStatusCode(),
$e->getHeaders()
);
}
public function render($request, Exception $e)
{
if ($this->isHttpException($e)) {
return $this->renderHttpException($e);
}
if (config('app.debug')) {
return $this->renderExceptionWithWhoops($e);
}
return parent::render($request, $e);
}