Custom Exception Handling for Laravel
composer require agilesdesign/exceptum
'providers' => [
Exceptum\Providers\ExceptumServiceProvider::class,
];
Abettor
is synonymous with App\Exceptions\Handler
in it's intent, but is not an extension of it.
Currently it only supports implementing the response provided to the render
method on App\Exception\Handler
class AuthorizatonExceptionAbettor implements Abettor
{
public function render($request, Exception $exception)
{
// handle exception
}
}
Exceptum falls back to Laravel's App\Exception\Handler class unless it knows about an Abettor responsible for Exception thrown.
To tell Exceptum about an Abettor register a mapping in your ServiceProviders
register
method
public function register()
{
Exceptum::map(AuthorizationException::class, AuthorizationExceptionAbettor::class);
}