LightningWeb.Live.AiAssistant.ErrorHandler (Lightning v2.14.5-pre1)

View Source

Error handling for AI Assistant interactions.

Transforms technical errors into user-friendly messages.

Summary

Functions

Extracts errors from Ecto changesets.

Formats errors into user-friendly messages.

Formats AI usage limit errors.

Functions

extract_changeset_errors(arg1)

@spec extract_changeset_errors(Ecto.Changeset.t()) :: [String.t()]

Extracts errors from Ecto changesets.

format_error(arg1)

@spec format_error(any()) :: String.t()

Formats errors into user-friendly messages.

Examples

iex> format_error({:error, "Something went wrong"})
"Something went wrong"

iex> format_error({:error, :timeout})
"Request timed out. Please try again."

format_limit_error(arg1)

@spec format_limit_error(any()) :: String.t()

Formats AI usage limit errors.

Examples

iex> format_limit_error({:error, :quota_exceeded})
"AI usage limit reached. Please try again later or contact support."