Changeset View
Changeset View
Standalone View
Standalone View
src/app/Exceptions/Handler.php
<?php | <?php | ||||
namespace App\Exceptions; | namespace App\Exceptions; | ||||
use Exception; | |||||
use Illuminate\Auth\AuthenticationException; | use Illuminate\Auth\AuthenticationException; | ||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||||
use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
class Handler extends ExceptionHandler | class Handler extends ExceptionHandler | ||||
{ | { | ||||
/** | /** @var string[] A list of the exception types that are not reported */ | ||||
* A list of the exception types that are not reported. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $dontReport = [ | protected $dontReport = [ | ||||
\Laravel\Passport\Exceptions\OAuthServerException::class, | \Laravel\Passport\Exceptions\OAuthServerException::class, | ||||
\League\OAuth2\Server\Exception\OAuthServerException::class | \League\OAuth2\Server\Exception\OAuthServerException::class | ||||
]; | ]; | ||||
/** | /** @var string[] A list of the inputs that are never flashed for validation exceptions */ | ||||
* A list of the inputs that are never flashed for validation exceptions. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $dontFlash = [ | protected $dontFlash = [ | ||||
'current_password', | |||||
'password', | 'password', | ||||
'password_confirmation', | 'password_confirmation', | ||||
]; | ]; | ||||
/** | |||||
* Report or log an exception. | |||||
* | |||||
* @param \Exception $exception | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function report(Exception $exception) | |||||
{ | |||||
parent::report($exception); | |||||
} | |||||
/** | /** | ||||
* Render an exception into an HTTP response. | * Register the exception handling callbacks for the application. | ||||
* | |||||
* @param \Illuminate\Http\Request $request | |||||
* @param \Exception $exception | |||||
* | |||||
* @return \Symfony\Component\HttpFoundation\Response | |||||
*/ | */ | ||||
public function render($request, Exception $exception) | public function register() | ||||
{ | { | ||||
$this->reportable(function (\Throwable $e) { | |||||
// Rollback uncommitted transactions | // Rollback uncommitted transactions | ||||
while (DB::transactionLevel() > 0) { | while (DB::transactionLevel() > 0) { | ||||
DB::rollBack(); | DB::rollBack(); | ||||
} | } | ||||
}); | |||||
return parent::render($request, $exception); | |||||
} | } | ||||
/** | /** | ||||
* Convert an authentication exception into a response. | * Convert an authentication exception into a response. | ||||
* | * | ||||
* @param \Illuminate\Http\Request $request | * @param \Illuminate\Http\Request $request | ||||
* @param \Illuminate\Auth\AuthenticationException $exception | * @param \Illuminate\Auth\AuthenticationException $exception | ||||
* | * | ||||
Show All 11 Lines |