Skip to content

Commit

Permalink
Throwable interface intead of Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
naillizard committed May 19, 2020
1 parent f171821 commit 6ab4ffd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ExceptionHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Lanin\Laravel\ApiExceptions;

use Exception;
use Throwable;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
Expand All @@ -16,11 +16,11 @@ trait ExceptionHandlerTrait
* Report or log an exception.
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @param Throwable $e
* @return void
* @throws Exception
*/
public function report(Exception $e)
public function report(Throwable $e)
{
parent::report($e instanceof ApiException ? $e->toReport() : $e);
}
Expand All @@ -29,10 +29,10 @@ public function report(Exception $e)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @param Throwable $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
public function render($request, Throwable $e)
{
$e = $this->resolveException($e);

Expand All @@ -44,10 +44,10 @@ public function render($request, Exception $e)
/**
* Define exception.
*
* @param Exception $e
* @param Throwable $e
* @return ApiException
*/
protected function resolveException(Exception $e)
protected function resolveException(Throwable $e)
{
switch (true) {
case $e instanceof ApiException:
Expand Down

0 comments on commit 6ab4ffd

Please sign in to comment.