Moebius.Error exception (Moebius v5.0.0)

Copy Markdown View Source

An error from Postgres, the driver or the pool.

Moebius's functions return {:error, message} with the message string, as they always have. Inside a transaction a failed statement raises this exception, and transaction/1 turns it back into {:error, message} after rolling back.

  • :code - the SQLSTATE, e.g. "23505". nil when the error didn't come from Postgres.
  • :name - the SQLSTATE as an atom, e.g. :unique_violation, or a Moebius reason such as :pool_timeout, :connection_lost or :bad_parameter.
  • :message - the primary message, as Postgres wrote it.
  • :detail, :hint, :constraint, :table, :column - extra fields Postgres sends when it has them.

Summary

Types

t()

@type t() :: %Moebius.Error{
  __exception__: term(),
  code: String.t() | nil,
  column: String.t() | nil,
  constraint: String.t() | nil,
  detail: String.t() | nil,
  hint: String.t() | nil,
  message: String.t(),
  name: atom() | nil,
  table: String.t() | nil
}