Bolty.Error exception (Bolty v0.0.12)

Copy Markdown

Summary

Functions

Return the code for the given error.

Gets the corresponding atom based on the error code.

Types

t()

@type t() :: %Bolty.Error{
  __exception__: true,
  bolt: %{code: binary(), message: binary() | nil} | nil,
  code: atom(),
  module: module(),
  packstream: %{bits: any() | nil} | nil
}

Functions

message(error)

@spec message(t()) :: String.t()

Return the code for the given error.

Examples

 iex> {:error, %Bolty.Error{} = error} = do_something()
 iex> Exception.message(error)
 "Unable to perform this action."

to_atom(error_message)

@spec to_atom(String.t()) :: atom()

Gets the corresponding atom based on the error code.

wrap(module, code)

@spec wrap(module(), atom()) :: t()
@spec wrap(module(), String.t()) :: t()
@spec wrap(module(), map()) :: t()

wrap(module, code, packstream)

@spec wrap(any(), any(), any()) :: t()