Skip to main content

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

AttributeTypeDescription
_errorsSequence[Any]Stores a sequence of validation errors that occurred, which are used to construct the exception message.
endpoint_ctx`EndpointContextNone`
endpoint_functionAnyStores the name of the function within the endpoint where the validation error occurred, used for detailed error reporting.
endpoint_pathAnyStores the path of the endpoint where the validation error occurred, used for detailed error reporting.
endpoint_fileAnyStores the file name of the endpoint where the validation error occurred, used for detailed error reporting.
endpoint_lineAnyStores 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

NameTypeDescription
errorsSequence[Any]A sequence of validation errors.
endpoint_ctx`EndpointContextNone` = 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

TypeDescription
Sequence[Any]A sequence of error objects, where each object represents a specific validation failure.