mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
sentry fixed
This commit is contained in:
parent
11e4621a26
commit
c188b37edb
@ -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),
|
||||
]
|
||||
);
|
||||
|
||||
@ -32,7 +32,7 @@ return [
|
||||
*/
|
||||
|
||||
'bindings' => [
|
||||
// 'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class
|
||||
'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user