adrema/app/Exceptions/Handler.php

64 lines
1.4 KiB
PHP
Raw Normal View History

2020-04-10 20:32:12 +02:00
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
2021-06-21 18:57:38 +02:00
use Zoomyboy\LaravelNami\NamiException;
2020-04-10 20:32:12 +02:00
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
2022-01-02 12:32:57 +01:00
* @var string[]
2020-04-10 20:32:12 +02:00
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
2022-01-02 12:32:57 +01:00
* @var string[]
2020-04-10 20:32:12 +02:00
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
2021-06-21 18:57:38 +02:00
if (is_a($exception, NamiException::class)) {
\Log::error($exception->getMessage(), [
'request' => $exception->request,
'response' => $exception->response
]);
}
2020-04-10 20:32:12 +02:00
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}