Some clean up in the error handler.

This commit is contained in:
James Cole
2016-02-12 14:15:49 +01:00
parent 46856c9394
commit 505f340917

View File

@@ -2,6 +2,7 @@
declare(strict_types = 1); declare(strict_types = 1);
namespace FireflyIII\Exceptions; namespace FireflyIII\Exceptions;
use Auth;
use ErrorException; use ErrorException;
use Exception; use Exception;
use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\Access\AuthorizationException;
@@ -13,7 +14,7 @@ use Mail;
use Request; use Request;
use Swift_TransportException; use Swift_TransportException;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Auth;
/** /**
* Class Handler * Class Handler
* *
@@ -68,14 +69,11 @@ class Handler extends ExceptionHandler
if ($exception instanceof FireflyException || $exception instanceof ErrorException) { if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
// log
Log::error($exception->getMessage());
// mail? // mail?
try { try {
$email = env('SITE_OWNER'); $email = env('SITE_OWNER');
$user = Auth::user(); $user = Auth::user();
$args = [ $args = [
'errorMessage' => $exception->getMessage(), 'errorMessage' => $exception->getMessage(),
'stacktrace' => $exception->getTraceAsString(), 'stacktrace' => $exception->getTraceAsString(),
'file' => $exception->getFile(), 'file' => $exception->getFile(),
@@ -99,7 +97,6 @@ class Handler extends ExceptionHandler
// could also not mail! :o // could also not mail! :o
Log::error($e->getMessage()); Log::error($e->getMessage());
} }
} }
parent::report($exception); parent::report($exception);