From d08fa37ccfe3598e19b21eab743d2ed9ff998aeb Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 11 Feb 2016 08:11:26 +0100 Subject: [PATCH] Expanded error handling. --- app/Exceptions/Handler.php | 6 ++++-- public/css/firefly.css | 21 +++++++++++++++++--- resources/views/errors/FireflyException.twig | 17 +++++++++++++--- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e39bfe16d1..0a5c1a01db 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,6 +2,7 @@ declare(strict_types = 1); namespace FireflyIII\Exceptions; +use ErrorException; use Exception; use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Database\Eloquent\ModelNotFoundException; @@ -41,7 +42,7 @@ class Handler extends ExceptionHandler */ public function render($request, Exception $exception) { - if ($exception instanceof FireflyException) { + if ($exception instanceof FireflyException || $exception instanceof ErrorException) { // log Log::error($exception->getMessage()); @@ -70,8 +71,9 @@ class Handler extends ExceptionHandler // could also not mail! :o Log::error($e->getMessage()); } + $isDebug = env('APP_DEBUG', false); - return response()->view('errors.FireflyException', ['exception' => $exception], 500); + return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500); } return parent::render($request, $exception); diff --git a/public/css/firefly.css b/public/css/firefly.css index ebcb8946b3..9843f2f058 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -12,10 +12,25 @@ padding: 0; } -.error-page { - background: #d2d6de; + +.ff-error-page { + width: 1000px; + margin: 20px auto 0 auto; } -.error-box { +.ff-error-page > .headline { + float: left; + font-size: 100px; + font-weight: 300; +} +.ff-error-page > .error-content { + margin-left: 190px; + display: block; +} +.ff-error-page > .error-content > h3 { + font-weight: 300; + font-size: 25px; +} +.ff-error-box { width: 460px; margin: 7% auto; } diff --git a/resources/views/errors/FireflyException.twig b/resources/views/errors/FireflyException.twig index 018657c2d9..b77ee64798 100644 --- a/resources/views/errors/FireflyException.twig +++ b/resources/views/errors/FireflyException.twig @@ -33,8 +33,8 @@ - -
+ +
@@ -55,7 +55,18 @@

- + +{% if debug %} +
+

Error

+

This error occured in file {{ exception.getFile }} on line {{ exception.getLine }} with + code {{ exception.getCode }}.

+

Stack trace

+
+ {{ exception.getTraceAsString|nl2br }} +
+
+{% endif %}