Rat Error v0.0.1 RatError.Formatter View Source

Formats a RAT error.

Formatter is used to retrieve the error Map result by formatting the parameters (error code, message, environment variables and so on) with the specified Structure (see ‘config/*.exs’ for detail).

Link to this section Summary

Functions

Format a RAT error with the specified Structure

Link to this section Functions

Link to this function format(structure, env, error_code, error_message) View Source

Format a RAT error with the specified Structure.

Examples

iex> structure = %Structure{node: :err, keys: [:code, :message]}
iex> message = "Bad response!"
iex> Formatter.format(structure, __ENV__, :bad_response, message)
%{err: %{code: :bad_response, message: "Bad response!"}}

iex> structure = %Structure{keys: [:code, :message]}
iex> message = "Out of memory!"
iex> Formatter.format(structure, __ENV__, :no_memory, message)
%{code: :no_memory, message: "Out of memory!"}