lux/data/error/exception

Exception-handling functionality built on top of the Error type.

Types

Exception

An exception provides a way to decorate error messages.

(type: Exception
  (-> lux;Text lux;Text))

Macros

exception:

## Define a new exception type.
## It moslty just serves as a way to tag error messages for later catching.
(exception: #export Some-Exception)

Values

(catch exception then try)

If a particular exception is detected on a possibly-erroneous value, handle it.

If no exception was detected, or a different one from the one being checked, then pass along the original value.

(All [a] (-> Exception (-> lux;Text a) (lux/data/error;Error a) (lux/data/error;Error a)))

(otherwise to-do try)

If no handler could be found to catch the exception, then run a function as a last-resort measure.

(All [a] (-> (-> lux;Text a) (lux/data/error;Error a) a))

(return value)

A way to lift normal values into the error-handling context.

(All [a] (-> a (lux/data/error;Error a)))

(throw exception message)

Decorate an error message with an Exception and lift it into the error-handling context.

(All [a] (-> Exception lux;Text (lux/data/error;Error a)))