4 ms·
Does it now catch system exceptions as well? Something that drove me away from php that i was not able to catch all errors inside an exception block.
by spdy 14y ago
Does it now catch system exceptions as well?
Something that drove me away from php that i was not able to catch all errors inside an exception block.
- wwweston 14y agoI think this has been possible more or less since PHP introduced exceptions by using `set_error_handler`: http://php.net/manual/en/function.set-error-handler.php http://php.net/manual/en/function.set-error-handler.php along with a function that throws exceptions, e.g.: function exception_on_error($errnum,$errmsg) { throw new ErrorException($errmsg,$errnum); } You can't catch all errors (sensibly including compile errors and unhandled exception errors), but it can get you pretty far. Not that there aren't other reasons not to use PHP, but this one is manageable.