Skip to content

Commit c6e431c

Browse files
authored
Merge pull request #12 from naillizard/laravel-7-support
Laravel 7 support
2 parents 3246041 + 6ab4ffd commit c6e431c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": "^7.2",
15-
"illuminate/support": "^6.0"
15+
"illuminate/support": "^6.0|^7.0"
1616
},
1717
"require-dev": {
1818
"orchestra/testbench": "^4.0",

src/ExceptionHandlerTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Lanin\Laravel\ApiExceptions;
44

5-
use Exception;
5+
use Throwable;
66
use Illuminate\Auth\Access\AuthorizationException;
77
use Illuminate\Auth\AuthenticationException;
88
use Illuminate\Database\Eloquent\ModelNotFoundException;
@@ -16,11 +16,11 @@ trait ExceptionHandlerTrait
1616
* Report or log an exception.
1717
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
1818
*
19-
* @param \Exception $e
19+
* @param Throwable $e
2020
* @return void
2121
* @throws Exception
2222
*/
23-
public function report(Exception $e)
23+
public function report(Throwable $e)
2424
{
2525
parent::report($e instanceof ApiException ? $e->toReport() : $e);
2626
}
@@ -29,10 +29,10 @@ public function report(Exception $e)
2929
* Render an exception into an HTTP response.
3030
*
3131
* @param \Illuminate\Http\Request $request
32-
* @param \Exception $e
32+
* @param Throwable $e
3333
* @return \Illuminate\Http\Response
3434
*/
35-
public function render($request, Exception $e)
35+
public function render($request, Throwable $e)
3636
{
3737
$e = $this->resolveException($e);
3838

@@ -44,10 +44,10 @@ public function render($request, Exception $e)
4444
/**
4545
* Define exception.
4646
*
47-
* @param Exception $e
47+
* @param Throwable $e
4848
* @return ApiException
4949
*/
50-
protected function resolveException(Exception $e)
50+
protected function resolveException(Throwable $e)
5151
{
5252
switch (true) {
5353
case $e instanceof ApiException:

0 commit comments

Comments
 (0)