Errors
Pydantic-specific errors.
PydanticErrorMixin ¶
PydanticErrorMixin(message, *, code)
A mixin class for common functionality shared by all Pydantic-specific errors.
Attributes:
| Name | Type | Description | 
|---|---|---|
| message | A message describing the error. | |
| code | An optional error code from PydanticErrorCodes enum. | 
Source code in pydantic/errors.py
                  | 75 76 77 |  | 
PydanticUserError ¶
PydanticUserError(message, *, code)
            Bases: PydanticErrorMixin, TypeError
An error raised due to incorrect use of Pydantic.
Source code in pydantic/errors.py
                  | 75 76 77 |  | 
PydanticUndefinedAnnotation ¶
PydanticUndefinedAnnotation(name, message)
            Bases: PydanticErrorMixin, NameError
A subclass of NameError raised when handling undefined annotations during CoreSchema generation.
Attributes:
| Name | Type | Description | 
|---|---|---|
| name | Name of the error. | |
| message | Description of the error. | 
Source code in pydantic/errors.py
                  | 98 99 100 |  | 
          from_name_error
  
  
      classmethod
  
¶
from_name_error(name_error)
Convert a NameError to a PydanticUndefinedAnnotation error.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| name_error | NameError | 
 | required | 
Returns:
| Type | Description | 
|---|---|
| Self | Converted  | 
Source code in pydantic/errors.py
            | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |  | 
PydanticImportError ¶
PydanticImportError(message)
            Bases: PydanticErrorMixin, ImportError
An error raised when an import fails due to module changes between V1 and V2.
Attributes:
| Name | Type | Description | 
|---|---|---|
| message | Description of the error. | 
Source code in pydantic/errors.py
                  | 126 127 |  | 
PydanticSchemaGenerationError ¶
PydanticSchemaGenerationError(message)
            Bases: PydanticUserError
An error raised during failures to generate a CoreSchema for some type.
Attributes:
| Name | Type | Description | 
|---|---|---|
| message | Description of the error. | 
Source code in pydantic/errors.py
                  | 137 138 |  | 
PydanticInvalidForJsonSchema ¶
PydanticInvalidForJsonSchema(message)
            Bases: PydanticUserError
An error raised during failures to generate a JSON schema for some CoreSchema.
Attributes:
| Name | Type | Description | 
|---|---|---|
| message | Description of the error. | 
Source code in pydantic/errors.py
                  | 148 149 |  |