ValidationException
This class represents an exception raised when validation errors occur. It encapsulates a sequence of errors and can optionally include context about the endpoint where the validation failed, such as the file, line, and function. The class provides methods to access the collected errors and formats a descriptive string representation of the exception, including endpoint details if available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| _errors | Sequence[Any] | Stores a sequence of validation errors that occurred, which are used to construct the exception message. |
| endpoint_ctx | `EndpointContext | None` |
| endpoint_function | Any | Stores the name of the function within the endpoint where the validation error occurred, used for detailed error reporting. |
| endpoint_path | Any | Stores the path of the endpoint where the validation error occurred, used for detailed error reporting. |
| endpoint_file | Any | Stores the file name of the endpoint where the validation error occurred, used for detailed error reporting. |
| endpoint_line | Any | Stores the line number within the endpoint file where the validation error occurred, used for detailed error reporting. |
Constructor
Signature
def ValidationException(
errors: Sequence[Any],
endpoint_ctx: EndpointContext | None = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| errors | Sequence[Any] | A sequence of validation errors. |
| endpoint_ctx | `EndpointContext | None` = None |
Methods
errors()
@classmethod
def errors() - > Sequence[Any]
Returns the sequence of validation errors that occurred. Callers use this to inspect the individual errors that led to the exception.
Returns
| Type | Description |
|---|---|
Sequence[Any] | A sequence of error objects, where each object represents a specific validation failure. |