|
|
@@ -16,6 +16,7 @@ namespace Cake\Error\Middleware;
|
|
|
|
|
|
use Cake\Core\App;
|
|
|
use Cake\Core\Configure;
|
|
|
+use Cake\Core\Exception\Exception as CakeException;
|
|
|
use Cake\Core\InstanceConfigTrait;
|
|
|
use Cake\Error\ExceptionRenderer;
|
|
|
use Cake\Log\Log;
|
|
|
@@ -90,7 +91,7 @@ class ErrorHandlerMiddleware
|
|
|
{
|
|
|
try {
|
|
|
return $next($request, $response);
|
|
|
- } catch (\Exception $e) {
|
|
|
+ } catch (Exception $e) {
|
|
|
return $this->handleException($e, $request, $response);
|
|
|
}
|
|
|
}
|
|
|
@@ -111,7 +112,7 @@ class ErrorHandlerMiddleware
|
|
|
$this->logException($request, $exception);
|
|
|
|
|
|
return $res;
|
|
|
- } catch (\Exception $e) {
|
|
|
+ } catch (Exception $e) {
|
|
|
$this->logException($request, $e);
|
|
|
|
|
|
$body = $response->getBody();
|
|
|
@@ -193,7 +194,7 @@ class ErrorHandlerMiddleware
|
|
|
);
|
|
|
$debug = Configure::read('debug');
|
|
|
|
|
|
- if ($debug && method_exists($exception, 'getAttributes')) {
|
|
|
+ if ($debug && $exception instanceof CakeException) {
|
|
|
$attributes = $exception->getAttributes();
|
|
|
if ($attributes) {
|
|
|
$message .= "\nException Attributes: " . var_export($exception->getAttributes(), true);
|