Normalizes Ash errors into a standard format consumed by the Vue frontend.
Error types produced by format/2:
"not_found"- The requested resource was not found."validation"- One or more fields failed validation. Includes afieldsmap with field-name keys and string-array values."conflict"- A global (non-field) conflict error with acodekey."forbidden"- The actor is not authorized for the action."unknown"- An unhandled error. In dev/test, includesdetailswith the formatted stacktrace. In production, returns a generic message.
Configuration:
:alva, :expose_unknown_errors- Set totrueto expose error details in production. Defaults totruein dev/test,falsein prod.
Summary
Functions
Formats an Ash error into a standardized map for the frontend.
Functions
@spec format(Exception.t() | struct() | term(), list() | nil) :: map()
Formats an Ash error into a standardized map for the frontend.
Accepts any Ash error struct and returns a map with :type, :message,
and optionally :fields or :details.