Errors
Pydantic-specific errors.
PydanticErrorMixin¶
PydanticErrorMixin(message:str,*,code:PydanticErrorCodes|None)
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 inpydantic/errors.py
909192 |
|
PydanticUserError¶
PydanticUserError(message:str,*,code:PydanticErrorCodes|None)
Bases:PydanticErrorMixin
,TypeError
An error raised due to incorrect use of Pydantic.
Source code inpydantic/errors.py
909192 |
|
PydanticUndefinedAnnotation¶
Bases:PydanticErrorMixin
,NameError
A subclass ofNameError
raised when handling undefined annotations duringCoreSchema
generation.
Attributes:
Name | Type | Description |
---|---|---|
name | Name of the error. | |
message | Description of the error. |
Source code inpydantic/errors.py
113114115 |
|
from_name_errorclassmethod
¶
from_name_error(name_error:NameError)->Self
Convert aNameError
to aPydanticUndefinedAnnotation
error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name_error | NameError |
| required |
Returns:
Type | Description |
---|---|
Self | Converted |
Source code inpydantic/errors.py
117118119120121122123124125126127128129130131 |
|
PydanticImportError¶
PydanticImportError(message:str)
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 inpydantic/errors.py
141142 |
|
PydanticSchemaGenerationError¶
PydanticSchemaGenerationError(message:str)
Bases:PydanticUserError
An error raised during failures to generate aCoreSchema
for some type.
Attributes:
Name | Type | Description |
---|---|---|
message | Description of the error. |
Source code inpydantic/errors.py
152153 |
|
PydanticInvalidForJsonSchema¶
PydanticInvalidForJsonSchema(message:str)
Bases:PydanticUserError
An error raised during failures to generate a JSON schema for someCoreSchema
.
Attributes:
Name | Type | Description |
---|---|---|
message | Description of the error. |
Source code inpydantic/errors.py
163164 |
|
PydanticForbiddenQualifier¶
PydanticForbiddenQualifier(qualifier:Qualifier,annotation:Any)
Bases:PydanticUserError
An error raised if a forbidden type qualifier is found in a type annotation.
Source code inpydantic/errors.py
179180181182183184185186 |
|