PhoenixKitManufacturing.Errors (PhoenixKitManufacturing v0.2.0)

Copy Markdown View Source

Central mapping from error atoms (returned by the Manufacturing module's public API and used across its LiveViews) to translated human-readable strings.

Keeping UI-facing copy in one place means every "not found" or "delete failed" flash reads the same wording. Callers pattern-match on atoms; message/1 wraps each mapping in gettext/1 at the UI boundary.

Supported reason shapes

  • plain atoms — :machine_not_found, :type_assignment_failed, etc.
  • strings — passed through unchanged
  • anything else — rendered as "Unexpected error: <inspect>"

Example

iex> PhoenixKitManufacturing.Errors.message(:machine_not_found)
"Machine not found."

Summary

Functions

Translates an error reason into a user-facing string via gettext.

Functions

message(reason)

@spec message(term()) :: String.t()

Translates an error reason into a user-facing string via gettext.