From dcfea2097381e7972f704577418f729fd6f57ab6 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Sat, 26 May 2018 13:14:51 +0200
Subject: [PATCH] Expand error logs.
---
app/Exceptions/Handler.php | 6 ++++++
resources/views/emails/error-html.twig | 4 +++-
resources/views/emails/error-text.twig | 2 ++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 45570ef71a..020f131bea 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -128,14 +128,17 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $exception)
{
+
$doMailError = env('SEND_ERROR_MESSAGE', true);
if (
(
$exception instanceof FireflyException
|| $exception instanceof ErrorException
|| $exception instanceof OAuthServerException
+ || $exception instanceof AuthenticationException
)
&& $doMailError) {
+
$userData = [
'id' => 0,
'email' => 'unknown@example.com',
@@ -153,6 +156,9 @@ class Handler extends ExceptionHandler
'line' => $exception->getLine(),
'code' => $exception->getCode(),
'version' => config('firefly.version'),
+ 'url' => Request::fullUrl(),
+ 'userAgent' => Request::userAgent(),
+ 'json' => Request::acceptsJson(),
];
// create job that will mail.
diff --git a/resources/views/emails/error-html.twig b/resources/views/emails/error-html.twig
index f3126c63e5..0e0f2004f0 100644
--- a/resources/views/emails/error-html.twig
+++ b/resources/views/emails/error-html.twig
@@ -24,7 +24,9 @@
- The IP address related to this error is: {{ ip }}
+ The IP address related to this error is: {{ ip }}
+ URL is: {{ url }}
+ User agent: {{ userAgent }}
diff --git a/resources/views/emails/error-text.twig b/resources/views/emails/error-text.twig
index 56d4ea7a39..6cc100d81a 100644
--- a/resources/views/emails/error-text.twig
+++ b/resources/views/emails/error-text.twig
@@ -14,6 +14,8 @@ This error occured in file "{{ file }}" on line {{ line }} with code {{ code }}.
{% endif %}
The IP address related to this error is: {{ ip }}
+URL is: {{ url }}
+User agent: {{ userAgent }}
The full stacktrace is below. If you think this is a bug in Firefly III, you
can forward this message to thegrumpydictator@gmail.com. This can help fix