29/11
2016
Custom Exception Handling for Laravel
Custom Exception Handling for Laravel, (*1)
composer require agilesdesign/exceptum
, (*2)
'providers' => [ Exceptum\Providers\ExceptumServiceProvider::class, ];
Abettor
is synonymous with App\Exceptions\Handler
in it's intent, but is not an extension of it., (*3)
Currently it only supports implementing the response provided to the render
method on App\Exception\Handler
```?php
class AuthorizatonExceptionAbettor implements Abettor
{
public function render($request, Exception $exception)
{
// handle exception
}
}, (*4)
##### Register Mapping 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 ```php public function register() { Exceptum::map(AuthorizationException::class, AuthorizationExceptionAbettor::class); }