PydanticCustomError
This class represents a custom error structure used for defining specific validation failures with a unique error type and a customizable message template. It allows for the inclusion of optional context data to provide additional metadata or dynamic values for error reporting.
Attributes
| Attribute | Type | Description |
|---|---|---|
| error_type | string | A unique identifier string that categorizes the specific type of validation error. |
| message_template | string | A string containing placeholders used to generate the human-readable error message. |
| context | dict = None | An optional dictionary of key-value pairs used to populate values within the message template. |
Constructor
Signature
def PydanticCustomError(
error_type: str,
message_template: str,
context: dict | None = None
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| error_type | str | The unique identifier for the error type. |
| message_template | str | A string template used to generate the error message. |
| context | `dict | None` = None |
Signature
def PydanticCustomError(
error_type: string,
message_template: string,
context: dict = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| error_type | string | A unique identifier string for the error type used to categorize the failure |
| message_template | string | A string template that defines the error message, potentially containing placeholders for context variables |
| context | dict = None | An optional dictionary of key-value pairs used to populate placeholders within the message template |