Localize.FormatError exception (Localize v0.32.0)

Copy Markdown View Source

Exception raised when a value cannot be formatted by the requested message format function due to an incompatible type or missing configuration.

The :reason field is a documented atom describing the failure category. The :detail field carries any additional human-readable context produced by a downstream formatter (for example, the Exception.message/1 text of the formatter's own error). The :cause field carries the underlying exception when one is available, so callers can pattern-match on the inner type.

Summary

Types

reason()

@type reason() ::
  :unbalanced_markup
  | :mismatched_close
  | :formatter_failed
  | :downstream_failure

t()

@type t() :: %Localize.FormatError{
  __exception__: true,
  cause: Exception.t() | nil,
  detail: String.t() | nil,
  function: atom() | nil,
  reason: reason() | nil,
  value: term() | nil
}