AshGettext.AshMessages.Translated exception (AshGettext v0.1.0)

Copy Markdown View Source

An Ash error whose text is now the translated sentence.

Ash prints its own errors from their module, not from a field, so the translated text needs a struct that prints it. This one keeps the original error, its field, path and class, and its message is the sentence the person reads. Exception.message/1 returns it, and JSON:API renders the original error with that sentence as its detail.

Summary

Functions

exception(msg)

@spec exception(opts :: Keyword.t()) :: %AshGettext.AshMessages.Translated{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  field: term(),
  message: term(),
  original: term(),
  path: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Create an Elixir.AshGettext.AshMessages.Translated without raising it.

Keys

  • :original
  • :field
  • :message