mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 20:22:07 +00:00
Include headers in error message.
This commit is contained in:
@@ -153,6 +153,12 @@ class Handler extends ExceptionHandler
|
||||
$userData['id'] = auth()->user()->id;
|
||||
$userData['email'] = auth()->user()->email;
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
if (request()->headers) {
|
||||
$headers = request()->headers->all();
|
||||
}
|
||||
|
||||
$data = [
|
||||
'class' => get_class($e),
|
||||
'errorMessage' => $e->getMessage(),
|
||||
@@ -165,11 +171,12 @@ class Handler extends ExceptionHandler
|
||||
'url' => request()->fullUrl(),
|
||||
'userAgent' => request()->userAgent(),
|
||||
'json' => request()->acceptsJson(),
|
||||
'headers' => $headers,
|
||||
];
|
||||
|
||||
// create job that will mail.
|
||||
$ipAddress = request()->ip() ?? '0.0.0.0';
|
||||
$job = new MailError($userData, (string)config('firefly.site_owner'), $ipAddress, $data);
|
||||
$job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
|
||||
dispatch($job);
|
||||
|
||||
parent::report($e);
|
||||
|
@@ -60,7 +60,8 @@ class MailError extends Job implements ShouldQueue
|
||||
$this->exception = $exceptionData;
|
||||
$debug = $exceptionData;
|
||||
unset($debug['stackTrace']);
|
||||
Log::error('Exception is: ' . json_encode($debug));
|
||||
unset($debug['headers']);
|
||||
Log::error(sprintf('Exception is: %s', json_encode($debug)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +82,7 @@ class MailError extends Job implements ShouldQueue
|
||||
$args,
|
||||
function (Message $message) use ($email) {
|
||||
if ('mail@example.com' !== $email) {
|
||||
$message->to($email, $email)->subject((string)trans('email.error_subject'));
|
||||
$message->to($email, $email)->subject((string) trans('email.error_subject'));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -97,6 +97,7 @@ return [
|
||||
'error_github_html' => 'If you prefer, you can also open a new issue on <a href="https://github.com/firefly-iii/firefly-iii/issues">GitHub</a>.',
|
||||
'error_github_text' => 'If you prefer, you can also open a new issue on https://github.com/firefly-iii/firefly-iii/issues.',
|
||||
'error_stacktrace_below' => 'The full stacktrace is below:',
|
||||
'error_headers' => 'The following headers may also be relevant:',
|
||||
|
||||
// report new journals
|
||||
'new_journals_subject' => 'Firefly III has created a new transaction|Firefly III has created :count new transactions',
|
||||
|
@@ -27,7 +27,6 @@
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
{{ trans('email.error_ip', { ip: ip }) }} (<a href="https://ipinfo.io/{{ ip }}/json?token={{ token }}">info</a>)<br />
|
||||
{{ trans('email.error_url', {url :url }) }}<br />
|
||||
{{ trans('email.error_user_agent', {userAgent: userAgent }) }}
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
@@ -42,4 +41,16 @@
|
||||
<p style="font-family: monospace;font-size:11px;color:#aaa">
|
||||
{{ stackTrace|nl2br }}
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||
{{ trans('email.error_headers') }}
|
||||
</p>
|
||||
<p style="font-family: monospace;font-size:11px;color:#aaa">
|
||||
{% for key, header in headers %}
|
||||
{% if (key != 'cookie') and header[0] != '' %}
|
||||
- {{ key }}: {{ header[0] }}<br>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
{% include 'emails.footer-html' %}
|
||||
|
@@ -24,4 +24,14 @@
|
||||
{{ trans('email.error_stacktrace_below')|raw }}
|
||||
|
||||
{{ stackTrace|raw }}
|
||||
|
||||
{{ trans('email.error_headers') }}
|
||||
|
||||
{% for key, header in headers %}
|
||||
{% if (key != 'cookie') and header[0] != '' %}
|
||||
- {{ key }}: {{ header[0] }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% include 'emails.footer-text' %}
|
||||
|
Reference in New Issue
Block a user