Browse files

Exception handler now produces plain text output when called from the…

… command line. Make reading crash dumps much simpler.
  • Loading branch information...
1 parent 7f09459 commit c617dfd66f59274634e6d099c26e10a8b797209a @rikh42 committed Mar 13, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 errors/ExceptionHandler.php
View
9 errors/ExceptionHandler.php
@@ -92,13 +92,18 @@ public function createResponse(\Exception $exception)
$code = 500;
$title = 'We\'re sorry, but it looks like something went wrong.';
$exception = FlattenException::create($exception);
- $content = FlattenExceptionFormatter::formatException($exception);
+ if (PHP_SAPI === 'cli') {
+ $content = FlattenExceptionFormatter::formatExceptionPlain($exception);
+ } else {
+ $content = $this->decorate(FlattenExceptionFormatter::formatException($exception), $title);
+ }
} catch (\Exception $e) {
$title = 'We\'re sorry, but it looks like something went wrong.';
+ $content = $this->decorate('', $title);
}
// build a response out of anything we got
- return new Response($this->decorate($content, $title), $code);
+ return new Response($content, $code);
}
protected function decorate($content, $title)

0 comments on commit c617dfd

Please sign in to comment.