1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00

Define error handler behavior

Resolves #95.
This commit is contained in:
Niklas Keller 2016-10-24 20:43:21 +02:00
parent 0581b38146
commit 27e7f2a05b
2 changed files with 10 additions and 2 deletions

View File

@ -342,10 +342,14 @@ final class Loop
/**
* 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.
*
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute; null will clear the current
* handler.
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute. `null` will clear the
* current handler.
*
* @return void
*/

View File

@ -227,6 +227,10 @@ abstract class Driver
/**
* 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.
*
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute. `null` will clear the