Skip to content

Firefly III: a personal finances manager

Expanded error handling.

James Coled08fa37ccfe3
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;
+}
+.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;
}
-.error-box {
+.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 @@
<meta name="theme-color" content="#ffffff">
</head>
-<body class="error-page">
-<div class="error-box">
+<body class="ff-error-page">
+<div class="ff-error-box">
<div class="login-logo">
<a href="{{ route('index') }}"><b>Firefly</b>III</a>
</div>
@@ -55,7 +55,18 @@
</p>
</div>
</div>
-
</div>
+
+{% if debug %}
+ <div class="error-stack">
+ <h4>Error</h4>
+ <p>This error occured in file <span style="font-family: monospace;">{{ exception.getFile }}</span> on line {{ exception.getLine }} with
+ code {{ exception.getCode }}.</p>
+ <h4>Stack trace</h4>
+ <div style="font-family: monospace;font-size:11px;">
+ {{ exception.getTraceAsString|nl2br }}
+ </div>
+ </div>
+{% endif %}
</body>
</html>