Skip to content

Commit ced6497

Browse files
authored
Merge pull request #110 from mriddle/add-exception-handling-note
Update README, remove exception handling ambiguity
2 parents e4bd860 + 396e1e5 commit ced6497

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Wrap a `use` block around the code's original behavior, and wrap `try` around th
2626
* Randomizes the order in which `use` and `try` blocks are run,
2727
* Measures the durations of all behaviors,
2828
* Compares the result of `try` to the result of `use`,
29-
* Swallows (but records) any exceptions raised in the `try` block, and
29+
* Swallow and record exceptions raised in the `try` block when overriding `raised`, and
3030
* Publishes all this information.
3131

3232
The `use` block is called the **control**. The `try` block is called the **candidate**.
@@ -71,6 +71,12 @@ class MyExperiment
7171
true
7272
end
7373

74+
def raised(operation, error)
75+
# see "In a Scientist callback" below
76+
p "Operation '#{operation}' failed with error '#{error.inspect}'"
77+
super # will re-raise
78+
end
79+
7480
def publish(result)
7581
# see "Publishing results" below
7682
p result

0 commit comments

Comments
 (0)