Created
July 12, 2016 00:40
-
-
Save max-dark/2e7dd2f1a2e6fa579f4aa0f669fea894 to your computer and use it in GitHub Desktop.
Enable all errors. Convert Errors to Exceptions
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 | |
const DEBUG = true; | |
error_reporting(DEBUG ? E_ALL : 0); | |
ini_set('display_errors', DEBUG ? 'on' : 'off'); | |
set_error_handler(function($err_no, $err_str, $err_file, $err_line ) { | |
if (!(error_reporting() & $err_no)) { | |
return; | |
} | |
throw new ErrorException($err_str, 0, $err_no, $err_file, $err_line); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment