error v0.3.5 Error View Source

Model domain and infrastructure errors as regular data.

Link to this section Summary

Functions

Extract the cause of an error (of type Error.t()).

Return the map of detailed information supplied at Error creation.

Create a domain error, with a reason and optional details.

Create an infra error, with a reason and optional details.

Determine whether a given Error is a domain or infra error.

Map a function on the details map in an Error.

Return the reason the Error was created with.

Convert an Error to an Elixir map.

Wrap a higher-level error 'on top' of a lower-level error.

Link to this section Types

Link to this section Functions

Link to this function

caused_by(arg1)

View Source
caused_by(t(a)) :: FE.Maybe.t(t(a)) when a: map()

Extract the cause of an error (of type Error.t()).

Think of this as inspecting deeper into the stack trace.

Link to this function

details(arg1)

View Source
details(t(a)) :: a when a: map()

Return the map of detailed information supplied at Error creation.

Link to this function

domain(reason, details \\ %{})

View Source
domain(atom(), a) :: t(a) when a: map()

Create a domain error, with a reason and optional details.

Link to this function

infra(reason, details \\ %{})

View Source
infra(atom(), a) :: t(a) when a: map()

Create an infra error, with a reason and optional details.

Determine whether a given Error is a domain or infra error.

Link to this function

map_details(error, f)

View Source
map_details(t(a), (a -> b)) :: t(b) when a: map(), b: map()

Map a function on the details map in an Error.

Useful for adding extra details, modifying exisint ones, or removing them.

Link to this function

reason(arg1)

View Source
reason(t()) :: reason()

Return the reason the Error was created with.

Convert an Error to an Elixir map.

Link to this function

wrap(inner, outer)

View Source
wrap(t(a), t(a)) :: t(a) when a: map()

Wrap a higher-level error 'on top' of a lower-level error.

Think of this as a stack trace, but in domain-model terms.