Skip to content

Errors ​

The base type of the errors a mutation returns as data, and the exception that validation converts into one.

ErrorType ​

source

Base class for GraphQL errors.

id ​

python
id: str = ErrorId.ERROR.value

InputValidationError ​

source

python
InputValidationError(validation: ValidationProtocol[Any], exception: Exception) -> None

Exception raised when input validation fails.

This exception wraps the original validation error and provides a method to convert it to a GraphQL-compatible error type.

Attributes:

NameTypeDescription
validationThe validation protocol instance that failed
exceptionThe original exception that was raised during validation

Initialize with the validation instance and original exception.

Parameters:

NameTypeDescriptionDefault
validationValidationProtocol[Any]The validation protocol instance that failedrequired
exceptionExceptionThe original exception that was raisedrequired

detail ​

python
detail: str = detail

exception ​

python
exception = exception

graphql_type ​

python
graphql_type() -> ValidationErrorType

Convert the validation error to a GraphQL-compatible error type.

Returns:

TypeDescription
ValidationErrorTypeA GraphQL-compatible error type that can be returned in a response

validation ​

python
validation = validation