File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Exception ;
6
6
use Illuminate \Http \Response ;
7
+ use Illuminate \Contracts \Support \Responsable ;
7
8
use Illuminate \Validation \ValidationException ;
8
9
use Illuminate \Contracts \Debug \ExceptionHandler ;
9
10
use Illuminate \Auth \Access \AuthorizationException ;
@@ -36,6 +37,10 @@ public function report(Exception $e)
36
37
return ;
37
38
}
38
39
40
+ if (method_exists ($ e , 'report ' )) {
41
+ return $ e ->report ();
42
+ }
43
+
39
44
try {
40
45
$ logger = app ('Psr\Log\LoggerInterface ' );
41
46
} catch (Exception $ ex ) {
@@ -82,6 +87,12 @@ protected function shouldntReport(Exception $e)
82
87
*/
83
88
public function render ($ request , Exception $ e )
84
89
{
90
+ if (method_exists ($ e , 'render ' )) {
91
+ return $ e ->render ($ request );
92
+ } elseif ($ e instanceof Responsable) {
93
+ return $ e ->toResponse ($ request );
94
+ }
95
+
85
96
if ($ e instanceof HttpResponseException) {
86
97
return $ e ->getResponse ();
87
98
} elseif ($ e instanceof ModelNotFoundException) {
You can’t perform that action at this time.
0 commit comments