From c188b37edb794a84d391e61290550b33265b3eb0 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Thu, 3 Jun 2021 14:00:38 +0300 Subject: [PATCH] sentry fixed --- app/Exceptions/ExceptionHandler.php | 44 +++++++++-------------------- config/streams.php | 2 +- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/app/Exceptions/ExceptionHandler.php b/app/Exceptions/ExceptionHandler.php index ecd41f005..9f3f95065 100644 --- a/app/Exceptions/ExceptionHandler.php +++ b/app/Exceptions/ExceptionHandler.php @@ -2,34 +2,19 @@ namespace App\Exceptions; -use Anomaly\Streams\Platform\Exception\ExceptionIdentifier; -use Exception; +use Swift_TransportException; +use Throwable; +use Illuminate\Support\Facades\Auth; use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Exceptions\Handler; -use Illuminate\Http\Request; -use Illuminate\Http\Response; -use Illuminate\Support\Facades\Auth; -use Swift_TransportException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Throwable; - +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class ExceptionHandler extends Handler { - - /** - * The exception instance. - * - * @var Exception - */ protected $original; - /** - * A list of the exception types that should not be reported. - * - * @var array - */ + protected $internalDontReport = [ \Illuminate\Auth\AuthenticationException::class, \Illuminate\Auth\Access\AuthorizationException::class, @@ -39,14 +24,14 @@ class ExceptionHandler extends Handler \Illuminate\Validation\ValidationException::class, ]; - protected function prepareException(Exception $e) + protected function prepareException(Throwable $e) { $this->original = $e; return parent::prepareException($e); // TODO: Change the autogenerated stub } - public function render($request, Exception $e) + public function render($request, Throwable $e) { if ($e instanceof AuthenticationException) { return $this->unauthenticated($request, $e); @@ -67,10 +52,10 @@ class ExceptionHandler extends Handler $summary = $e->getMessage(); $headers = $e->getHeaders(); - $code = $e->getStatusCode(); - $name = trans("streams::error.{$code}.name"); + $code = $e->getStatusCode(); + $name = trans("streams::error.{$code}.name"); $message = trans("streams::error.{$code}.message"); - $id = $this->container->make(ExceptionIdentifier::class)->identify($this->original); + $id = $this->container->make(ExceptionIdentifier::class)->identify($this->original); if (view()->exists($view = "streams::errors/{$code}")) { return response()->view($view, compact('id', 'code', 'name', 'message', 'summary'), $code, $headers); @@ -84,8 +69,7 @@ class ExceptionHandler extends Handler ); } - - public function report(Exception $e) + public function report(Throwable $e) { if (app()->bound('sentry') && $this->shouldReport($e) @@ -107,9 +91,9 @@ class ExceptionHandler extends Handler try { return array_filter( [ - 'user' => Auth::id(), - 'email' => Auth::user() ? Auth::user()->email : null, - 'url' => request() ? request()->fullUrl() : null, + 'user' => Auth::id(), + 'email' => Auth::user() ? Auth::user()->email : null, + 'url' => request() ? request()->fullUrl() : null, 'identifier' => $this->container->make(ExceptionIdentifier::class)->identify($this->original), ] ); diff --git a/config/streams.php b/config/streams.php index c085a2c12..7add737bb 100644 --- a/config/streams.php +++ b/config/streams.php @@ -32,7 +32,7 @@ return [ */ 'bindings' => [ - // 'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class + 'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class ], /*