Skip to content

Instantly share code, notes, and snippets.

@max-dark
Created July 12, 2016 00:40
Show Gist options
  • Save max-dark/2e7dd2f1a2e6fa579f4aa0f669fea894 to your computer and use it in GitHub Desktop.
Save max-dark/2e7dd2f1a2e6fa579f4aa0f669fea894 to your computer and use it in GitHub Desktop.
Enable all errors. Convert Errors to Exceptions
<?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