Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": "^7.2",
"illuminate/support": "^6.0"
"illuminate/support": "^6.0|^7.0"
},
"require-dev": {
"orchestra/testbench": "^4.0",
Expand Down
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