Skip to content

Commit

Permalink
Merge pull request amphp#110 from async-interop/issue-95
Browse files Browse the repository at this point in the history
Define error handler behavior
  • Loading branch information
bwoebi committed Oct 25, 2016
2 parents 0581b38 + 27e7f2a commit 11c04e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,14 @@ public static function getState($key)
/**
* 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
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Loop/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ final public function getState($key)
/**
* 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
Expand Down

0 comments on commit 11c04e9

Please sign in to comment.