Module: error

Members

(static, constant) error

When a function from this library throws an error, it calls one of the methods defined on this object, which constructs and then passes an error message to the throwError function with the arguments to the original method call applied to the appropriate error template string.

Source:
Example
error.typeError(0, and); // => *** Error: '0' is not a valid argument to function 'and'.

Methods

(static) throwError(e)

Throw an error, outputting the given message. This is one of the only impure functions in this library and reflects the (some would say unfortunate) inclusion of numerous partial functions in the Haskell Prelude. Whereas a total function will always return a predictable output for a given input, a partial function fails to take into account all possible inputs. One way to address this situation would be to wrap potentially undefined values (such as the head of an empty list) in a Maybe or Either abstraction in order to account for error states.

Parameters:
Name Type Description
e string

The error message to display

Source:
Throws:

Throws an error with a given message.