Error.if_not_error
if_not_errorpassthru
Documentation
Returns the provided passthru value, unless self is an error.
The primary application of this function is to introduce a dataflow dependency between two otherwise unrelated operations. Very useful if one of the operations is performing a side-effect.
Aside from ensuring that any dataflow errors are propagated, the result will also inherit any warnings attached to any of the two inputs.
Arguments
passthru: The value to return ifselfis not an error.
Returns
passthru if self is not an error; otherwise, returns the error.
Returns
passthru if self is not an error; otherwise, returns the error.
Examples
Writing to a file and returning the file object if all went well, or an
error if it failed.
file.write "foo" . if_not_error file