16
16
17
17
use Cake \Core \App ;
18
18
use Cake \Core \Configure ;
19
+ use Cake \Core \Exception \Exception as CakeException ;
19
20
use Cake \Core \InstanceConfigTrait ;
20
21
use Cake \Error \ExceptionRenderer ;
21
22
use Cake \Log \Log ;
@@ -90,7 +91,7 @@ public function __invoke($request, $response, $next)
90
91
{
91
92
try {
92
93
return $ next ($ request , $ response );
93
- } catch (\ Exception $ e ) {
94
+ } catch (Exception $ e ) {
94
95
return $ this ->handleException ($ e , $ request , $ response );
95
96
}
96
97
}
@@ -111,7 +112,7 @@ public function handleException($exception, $request, $response)
111
112
$ this ->logException ($ request , $ exception );
112
113
113
114
return $ res ;
114
- } catch (\ Exception $ e ) {
115
+ } catch (Exception $ e ) {
115
116
$ this ->logException ($ request , $ e );
116
117
117
118
$ body = $ response ->getBody ();
@@ -193,7 +194,7 @@ protected function getMessage($request, $exception)
193
194
);
194
195
$ debug = Configure::read ('debug ' );
195
196
196
- if ($ debug && method_exists ( $ exception, ' getAttributes ' ) ) {
197
+ if ($ debug && $ exception instanceof CakeException ) {
197
198
$ attributes = $ exception ->getAttributes ();
198
199
if ($ attributes ) {
199
200
$ message .= "\nException Attributes: " . var_export ($ exception ->getAttributes (), true );
0 commit comments