Skip to content

Instantly share code, notes, and snippets.

@fordnox
Created May 17, 2014 09:52
Show Gist options
  • Save fordnox/a48c7cf6495dd74e8674 to your computer and use it in GitHub Desktop.
Save fordnox/a48c7cf6495dd74e8674 to your computer and use it in GitHub Desktop.
PHP snippet to throw exceptions instead of fatal errors
<?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