Created
July 20, 2020 21:12
-
-
Save GromNaN/7f41f73cc22f788009b26e582cdbb887 to your computer and use it in GitHub Desktop.
Autoload error handler
This file contains 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
{ | |
"name": "<to-be-defined>", | |
"type": "library", | |
"license": "MIT", | |
"autoload": { | |
"files": [ "handler.php" ] | |
} | |
} |
This file contains 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 | |
/** | |
* Convert error to exception. | |
* | |
* @author Frédéric Bouchery | |
* @link https://twitter.com/FredBouchery/status/1285210405317615617/photo/1 | |
*/ | |
\set_error_handler(function ($severity, $message, $file, $line) { | |
throw new \ErrorException($message, 0, $severity, $file, $line); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment