From f3fa0513fe2e1994923793b85c593b7f2b644001 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Mon, 29 Feb 2016 00:38:10 -0800 Subject: [PATCH] Updated error handling for PHP 7. --- VERSION | 2 +- flight/Engine.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 9ddbe16..53fc08d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.19 +1.2.20 diff --git a/flight/Engine.php b/flight/Engine.php index d55db3f..0ac148a 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -148,9 +148,9 @@ class Engine { /** * Custom exception handler. Logs exceptions. * - * @param \Exception $e Thrown exception + * @param object $e Thrown exception */ - public function handleException(\Exception $e) { + public function handleException($e) { if ($this->get('flight.log_errors')) { error_log($e->getMessage()); } @@ -354,9 +354,9 @@ class Engine { /** * Sends an HTTP 500 response for any errors. * - * @param \Exception Thrown exception + * @param object $e Thrown exception */ - public function _error(\Exception $e) { + public function _error($e) { $msg = sprintf('

500 Internal Server Error

'. '

%s (%s)

'. '
%s
', @@ -371,6 +371,9 @@ class Engine { ->write($msg) ->send(); } + catch (\Throwable $t) { + exit($msg); + } catch (\Exception $ex) { exit($msg); }