Updated error handling for PHP 7.

pull/243/head v1.2.20
Mike Cao 9 years ago
parent b96aaa7967
commit f3fa0513fe

@ -1 +1 @@
1.2.19 1.2.20

@ -148,9 +148,9 @@ class Engine {
/** /**
* Custom exception handler. Logs exceptions. * 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')) { if ($this->get('flight.log_errors')) {
error_log($e->getMessage()); error_log($e->getMessage());
} }
@ -354,9 +354,9 @@ class Engine {
/** /**
* Sends an HTTP 500 response for any errors. * 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('<h1>500 Internal Server Error</h1>'. $msg = sprintf('<h1>500 Internal Server Error</h1>'.
'<h3>%s (%s)</h3>'. '<h3>%s (%s)</h3>'.
'<pre>%s</pre>', '<pre>%s</pre>',
@ -371,6 +371,9 @@ class Engine {
->write($msg) ->write($msg)
->send(); ->send();
} }
catch (\Throwable $t) {
exit($msg);
}
catch (\Exception $ex) { catch (\Exception $ex) {
exit($msg); exit($msg);
} }

Loading…
Cancel
Save