Typed failure returned by AshOnetime boundary modules.
AshOnetime.Error is a Splode error of class :invalid,
so Ash recognizes it and preserves it through the action pipeline instead of wrapping it
as an unknown error. The typed :code therefore reaches the caller inside
Ash.Error.Invalid{errors: [%AshOnetime.Error{code: ...}]}, where it can drive HTTP
status mapping (AshOnetime.Error.code/1) — see documentation/errors.md for the
code→HTTP table.
Summary
Functions
Returns the typed :code from an AshOnetime.Error, or the single leaf
AshOnetime.Error inside an Ash.Error.Invalid/Ash.Error.Unknown class wrapper.
Create an Elixir.AshOnetime.Error without raising it.
Types
Functions
@spec code(t() | Exception.t() | term()) :: atom() | nil
Returns the typed :code from an AshOnetime.Error, or the single leaf
AshOnetime.Error inside an Ash.Error.Invalid/Ash.Error.Unknown class wrapper.
Returns nil for any other value (including exceptions that are not AshOnetime.Error
and class wrappers carrying no AshOnetime.Error leaf), so a caller can distinguish
"ash_onetime rejected this with a known code" from "some other error occurred" without
pattern-matching the wrapper shape.
@spec exception(opts :: Keyword.t()) :: %AshOnetime.Error{ __exception__: term(), bread_crumbs: term(), class: term(), code: term(), details: term(), message: term(), path: term(), splode: term(), stacktrace: term(), vars: term() }
Create an Elixir.AshOnetime.Error without raising it.
Keys
- :code
- :message
- :details