Correios CEP v0.7.0 Correios.CEP.Error exception View Source

Error structure.

Link to this section Summary

Functions

Creates a new Correios.CEP.Error exception with the given type, message and reason.

Link to this section Types

Specs

t() :: %Correios.CEP.Error{
  __exception__: term(),
  message: String.t(),
  reason: String.t() | nil,
  type: atom() | nil
}

Link to this section Functions

Link to this function

new(type, message, reason \\ nil)

View Source

Specs

new(atom(), String.t(), any()) :: t()

Creates a new Correios.CEP.Error exception with the given type, message and reason.

Examples

iex> Correios.CEP.Error.new(:some_type, "Some message", "Catastrophic error!")
%Correios.CEP.Error{
  type: :some_type,
  message: "Some message",
  reason: "Catastrophic error!"
}

iex> Correios.CEP.Error.new(:some_type, "Some message", 'Catastrophic error!')
%Correios.CEP.Error{
  type: :some_type,
  message: "Some message",
  reason: "Catastrophic error!"
}

iex> Correios.CEP.Error.new(:some_type, "Some message")
%Correios.CEP.Error{
  type: :some_type,
  message: "Some message",
  reason: nil
}