zest v0.1.2 Zest View Source

Link to this section Summary

Functions

Iterates over a collections, calling the provided effectful function with each item.

Iterates over two collections, calling the provided effectful function with each pair of items

You take on the role of the apply function in this exciting function that wraps execution of a function such that your function is responsible for calling it.

Add some debug information to the context for the duration of a function's execution. If a raise, throw or exit occurs, the context will be pretty printed to the screen to aid with debugging.

Catches errors and exceptions, invoking an interceptor function

An interceptor function which simply rethrows/reraises/re-exits

Wraps an interceptor or nullary function into an interceptor function such that after the execution of the provided function, the error or exception will be rethrown.

Add some debug information to the context for the duration of a block or expression. If a raise, throw or exit occurs, the context will be pretty printed to the screen to aid with debugging.

Wrap a function such that it is as if its body was wrapped in scope/2

Link to this section Types

Link to this type

intercept_type()

View Source
intercept_type() :: :rescue | :catch | :exit
Link to this type

interceptor()

View Source
interceptor() ::
  (intercept_type(), error :: term(), maybe_stacktrace :: term() -> term())

Link to this section Functions

Iterates over a collections, calling the provided effectful function with each item.

Iterates over two collections, calling the provided effectful function with each pair of items

Link to this function

hijack(fun, jack)

View Source
hijack(function(), jack :: (function(), [term()] -> term())) :: function()

You take on the role of the apply function in this exciting function that wraps execution of a function such that your function is responsible for calling it.

Link to this function

in_scope(scopes, fun)

View Source
in_scope(Keyword.t(), function()) :: term()

Add some debug information to the context for the duration of a function's execution. If a raise, throw or exit occurs, the context will be pretty printed to the screen to aid with debugging.

Link to this function

intercept(fun, interceptor)

View Source
intercept(function(), interceptor()) :: function()

Catches errors and exceptions, invoking an interceptor function

Link to this function

rethrow(atom, e, stacktrace)

View Source
rethrow(intercept_type(), error :: term(), maybe_stacktrace :: term()) :: none()

An interceptor function which simply rethrows/reraises/re-exits

Link to this function

rethrowing(fun)

View Source
rethrowing(function()) :: function()

Wraps an interceptor or nullary function into an interceptor function such that after the execution of the provided function, the error or exception will be rethrown.

Link to this macro

scope(list, expr)

View Source (macro)

Add some debug information to the context for the duration of a block or expression. If a raise, throw or exit occurs, the context will be pretty printed to the screen to aid with debugging.

Examples:

scope [foo: :bar[, assert(true == false)

scope [foo: :bar] do assert true == false end

Link to this function

scoped(scopes, fun)

View Source
scoped(Keyword.t(), region :: function()) :: function()

Wrap a function such that it is as if its body was wrapped in scope/2