Postgrex.ErrorCode

Source

Summary

code_to_name(code)

Translates a Postgres error code into a name

name_to_code(name)

Translates a Postgres error name into a list of possible codes. Most error names have only a single code, but there are exceptions

Functions

code_to_name(code)

Specs:

  • code_to_name(String.t) :: atom | no_return

Translates a Postgres error code into a name

Examples:

iex> code_to_name("23505")
:unique_violation
Source
name_to_code(name)

Specs:

  • name_to_code(atom) :: [String.t] | no_return

Translates a Postgres error name into a list of possible codes. Most error names have only a single code, but there are exceptions.

Examples:

iex> name_to_code(:prohibited_sql_statement_attempted)
"2F003"
Source