function EventLoop::setErrorHandler
Set a callback to be executed when an error occurs.
The callback receives the error as the first and only parameter. The return value of the callback gets ignored. If it can't handle the error, it MUST throw the error. Errors thrown by the callback or during its invocation MUST be thrown into the `run` loop and stop the driver.
Subsequent calls to this method will overwrite the previous handler.
Parameters
null|\Closure(\Throwable):void $errorHandler The callback to execute. `null` will clear the current handler.:
File
-
vendor/
revolt/ event-loop/ src/ EventLoop.php, line 307
Class
- EventLoop
- Accessor to allow global access to the event loop.
Namespace
RevoltCode
public static function setErrorHandler(?\Closure $errorHandler) : void {
self::getDriver()->setErrorHandler($errorHandler);
}