set_error_handler( function( $errno, $errstr, $errfile, $errline, $errcontext ) {
	$err = "Error: $errstr";
	if ( $errfile ) {
		$err .= " in $errfile";
		if ( $errline ) {
			$err .= ", line $errline";
		}
	}
	$err .= ".\n";
	die( $err );
}, E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE );
set_error_handler( function( $errno, $errstr, $errfile, $errline, $errcontext ) {
	throw new ErrorException( $errstr, $errno, E_ERROR, $errfile, $errline );
}, E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE );


Make warnings_as_errors role throw exceptions
Make warnings_as_errors role throw exceptions

The warnings_as_errors role turned errors into die() calls,
which is an exceedingly bad idea: it circumvents try-catch blocks and
turns relatively harmless errors into unclean aborts which trigger
a torrent of unrelated errors (such as uncommit translation warnings).
Just throw an ErrorException instead.

Change-Id: Id6698f5b4c931aba367dffef2921c5fcdbf3ed58
