Created
May 17, 2014 09:52
-
-
Save fordnox/a48c7cf6495dd74e8674 to your computer and use it in GitHub Desktop.
PHP snippet to throw exceptions instead of fatal errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_shutdown_function(function() { | |
$error = error_get_last(); | |
$message = $error['message']; | |
if ($error['type'] == 64 && !empty($message)) { | |
throw new Exception($message); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment