function Driver::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.
2 methods override Driver::setErrorHandler()
- AbstractDriver::setErrorHandler in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php - Set a callback to be executed when an error occurs.
- TracingDriver::setErrorHandler in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ TracingDriver.php - Set a callback to be executed when an error occurs.
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Driver.php, line 254
Class
- Driver
- The driver MUST run in its own fiber and execute callbacks in a separate fiber. If fibers are reused, the driver needs to call {
Namespace
Revolt\EventLoopCode
public function setErrorHandler(?\Closure $errorHandler) : void;