Some changes to the error handler

This commit is contained in:
James Cole 2016-02-11 14:13:23 +01:00
parent f1750e3c35
commit 43ff3e11ed
3 changed files with 18 additions and 7 deletions

View File

@ -12,7 +12,6 @@ use Log;
use Mail; use Mail;
use Swift_TransportException; use Swift_TransportException;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Auth;
/** /**
* Class Handler * Class Handler
@ -51,15 +50,17 @@ class Handler extends ExceptionHandler
// mail? // mail?
try { try {
$email = env('SITE_OWNER'); $email = env('SITE_OWNER');
$user = $request->user();
$args = [ $args = [
'errorMessage' => $exception->getMessage(), 'errorMessage' => $exception->getMessage(),
'stacktrace' => $exception->getTraceAsString(), 'stacktrace' => $exception->getTraceAsString(),
'file' => $exception->getFile(), 'file' => $exception->getFile(),
'line' => $exception->getLine(), 'line' => $exception->getLine(),
'code' => $exception->getCode(), 'code' => $exception->getCode(),
'loggedIn' => Auth::check(), 'loggedIn' => !is_null($user),
'user' => Auth::user(), 'user' => $user,
'ip' => $request->ip(),
]; ];
Mail::send( Mail::send(

View File

@ -12,11 +12,17 @@
This error occured in file <span style="font-family: monospace;">{{ file }}</span> on line {{ line }} with code {{ code }}. This error occured in file <span style="font-family: monospace;">{{ file }}</span> on line {{ line }} with code {{ code }}.
</p> </p>
{% if loggedIn %}
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;"> <p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
The error was encountered by user #{{ user.id }}, <a href="mailto:{{ user.email }}">{{ user.email }}</a>. {% if loggedIn %}
The error was encountered by user #{{ user.id }}, <a href="mailto:{{ user.email }}">{{ user.email }}</a>.
{% else %}
There was no user logged in for this error or no user was detected.
{% endif %}
</p>
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
The IP address related to this error is: {{ ip }}
</p> </p>
{% endif %}
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;"> <p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
The full stacktrace is below. If you think this is a bug in Firefly III, you The full stacktrace is below. If you think this is a bug in Firefly III, you

View File

@ -4,8 +4,12 @@ This error occured in file "{{ file }}" on line {{ line }} with code {{ code }}.
{% if loggedIn %} {% if loggedIn %}
The error was encountered by user #{{ user.id }}, {{ user.email }}. The error was encountered by user #{{ user.id }}, {{ user.email }}.
{% else}
There was no user logged in for this error or no user was detected.
{% endif %} {% endif %}
The IP address related to this error is: {{ ip }}
The full stacktrace is below. If you think this is a bug in Firefly III, you 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 can forward this message to thegrumpydictator@gmail.com. This can help fix
the bug you just encountered. the bug you just encountered.