errors¶
errors
¶
Standardized error codes and messages for the AI Translate application.
get_error_message
¶
Returns the localized message corresponding to an error code.
ソースコード位置: src/constants/errors.py
map_tag_to_code
¶
Maps an error tag string to a standardized error code.
| 引数 | デスクリプション |
|---|---|
msg
|
The exception message string (may contain a tag prefix).
タイプ:
|
| 戻り値 | デスクリプション |
|---|---|
int
|
The corresponding error code, or ERR_UNKNOWN if unrecognized.
タイプ:
|
ソースコード位置: src/constants/errors.py
base_error_tag
¶
Returns the base error tag, stripping any :Service suffix.
The engine appends a service-name suffix to AUTH_ERROR raises
("AUTH_ERROR:Gemini" etc.) so the UI can render service-aware
messages. Set-membership consumers — fatal-error checks in the
PDF / Office image processors, the LLM dispatcher's
informative-response filter, etc. — need the BASE tag for their
exact-match comparisons; without this strip they'd silently miss
every suffixed AUTH_ERROR and demote fatal errors to skip-with-
warning.
| 引数 | デスクリプション |
|---|---|
tag
|
The raw tag string, with or without a
タイプ:
|
| 戻り値 | デスクリプション |
|---|---|
str
|
The portion of |
str
|
tag if no colon present). |
ソースコード位置: src/constants/errors.py
_extract_auth_service
¶
Extracts the service-name suffix from an AUTH_ERROR:Service tag.
Engines that touch a remote auth-required service raise
ValueError("AUTH_ERROR:Service Name") to surface WHICH key the
user must fix (Google Cloud / Soniox / ElevenLabs / Gemini / a
user-named Custom provider). Without the suffix, the user sees
"Invalid API key" with no hint which Settings tab to open.
Returns the service name if a suffix is present, otherwise empty
string (legacy raises that didn't pass a service). Strips
surrounding whitespace so callers can write
f"AUTH_ERROR:{name}" without trimming themselves.
ソースコード位置: src/constants/errors.py
display_error_message
¶
Converts a raw error tag string to a localized user-friendly message.
Checks against known tag strings (e.g. "MODEL_NOT_FOUND", "AUTH_ERROR") and returns a localized message. If the raw message doesn't match any known tag, it is returned as-is (it may already be localized).
| 引数 | デスクリプション |
|---|---|
raw_msg
|
The raw error message (tag string or already-localized text).
タイプ:
|
| 戻り値 | デスクリプション |
|---|---|
str
|
A user-friendly, localized error message.
タイプ:
|