serum v1.0.0 Serum.Result

This module defines types for positive results or errors returned by functions in this project.

Link to this section Summary

Functions

Takes a list of result objects (without returned values) and checks if there is no error.

Takes a list of result objects (with returned values) and checks if there is no error.

Prints an error object in a beautiful format.

Link to this section Types

Link to this type

err_details()
err_details() :: msg_detail() | full_detail() | nest_detail()

Link to this type

error()
error() :: {:error, err_details()}

Link to this type

file()
file() :: binary()

Link to this type

full_detail()
full_detail() :: {message(), file(), line()}

Link to this type

message()
message() :: binary()

Link to this type

msg_detail()
msg_detail() :: message()

Link to this type

nest_detail()
nest_detail() :: {term(), [error()]}

Link to this type

t()
t() :: :ok | error()

Link to this type

t(type)
t(type) :: {:ok, type} | error()

Link to this section Functions

Link to this function

aggregate(results, from)
aggregate([t()], term()) :: t()

Takes a list of result objects (without returned values) and checks if there is no error.

Returns :ok if there is no error.

Returns an aggregated error object if there is one or more errors.

Link to this function

aggregate_values(results, from)
aggregate_values([t(term())], term()) :: t([term()])

Takes a list of result objects (with returned values) and checks if there is no error.

If there is no error, it returns {:ok, list} where list is a list of returned values.

Returns an aggregated error object if there is one or more errors.

Link to this function

show(result, indent \\ 0)
show(t(), non_neg_integer()) :: :ok

Prints an error object in a beautiful format.