Page MenuHomePhorge
Diviner libphutil Tech Docs phutil_error_listener_example

function phutil_error_listener_example($event, $value, $metadata)
libphutil Technical Documentation (Errors)

Example PhutilErrorHandler error listener callback. When you call PhutilErrorHandler::setErrorListener(), you must pass a callback function with the same signature as this one.

NOTE: PhutilErrorHandler handles writing messages to the error log, so you only need to provide a listener if you have some other console (like Phabricator's DarkConsole) which you also want to send errors to.
NOTE: You will receive errors which were silenced with the @ operator. If you don't want to display these, test for @ being in effect by checking if error_reporting() === 0 before displaying the error.
Parameters
const$eventA PhutilErrorHandler constant, like PhutilErrorHandler::ERROR, which indicates the event type (e.g. error, exception, user message).
wild$valueThe event value, like the Exception object for an exception event, an error string for an error event, or some user object for user messages.
dict$metadataA dictionary of metadata about the event. The keys 'file', 'line' and 'trace' are always available. Other keys may be present, depending on the event type.
Return
void