Skip to content

Commit

Permalink
Merge pull request #12 from naillizard/laravel-7-support
Browse files Browse the repository at this point in the history
Laravel 7 support
  • Loading branch information
mlanin authored May 21, 2020
2 parents 3246041 + 6ab4ffd commit c6e431c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit c6e431c

Please sign in to comment.