nglcobdai_utils.base
- exception TemplateError(**kwargs)[source]
Bases:
Exception
Custom exception that formats error messages with a code and note. Allows customization of the message format, code, and note.
- __init__(**kwargs)[source]
Initialize with optional keyword arguments for note formatting.
- Parameters:
**kwargs – Formatting arguments for the note.
- __str__()[source]
Return the formatted error message with code and note.
- Returns:
Formatted error message.
- Return type:
str
- property message
Full error message as a string.
- Returns:
Formatted error message.
- Return type:
str
- property message_format
Current message format.
- Returns:
Message format.
- Return type:
str
- classmethod set_message_format(value)[source]
Set a new format for the error message.
- Parameters:
value (str) – New message format.
- property code
Error code.
- Returns:
Error code.
- Return type:
str
- classmethod set_code(value)[source]
Set a new error code.
- Parameters:
value (str) – New error code.
- property note
Note message with optional placeholders.
- Returns:
Note message.
- Return type:
str