Errors
Pydantic-specific errors.
PydanticErrorMixin ¶
PydanticErrorMixin(message: str, *, code: PydanticErrorCodes | None)
A mixin class for common functionality shared by all Pydantic-specific errors.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
message |
A message describing the error. |
|
code |
An optional error code from PydanticErrorCodes enum. |
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
90 91 92 | |
PydanticUserError ¶
PydanticUserError(message: str, *, code: PydanticErrorCodes | None)
Bases: PydanticErrorMixin, TypeError
An error raised due to incorrect use of Pydantic.
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
90 91 92 | |
PydanticUndefinedAnnotation ¶
Bases: PydanticErrorMixin, NameError
A subclass of NameError raised when handling undefined annotations during CoreSchema generation.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
name |
Name of the error. |
|
message |
Description of the error. |
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
113 114 115 | |
from_name_error
classmethod
¶
Convert a NameError to a PydanticUndefinedAnnotation error.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
name_error
|
NameError
|
|
必需 |
返回:
| 类型 | 描述 |
|---|---|
Self
|
Converted |
源代码位于: .venv/lib/python3.13/site-packages/pydantic/errors.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
PydanticImportError ¶
PydanticImportError(message: str)
Bases: PydanticErrorMixin, ImportError
An error raised when an import fails due to module changes between V1 and V2.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
message |
Description of the error. |
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
141 142 | |
PydanticSchemaGenerationError ¶
PydanticSchemaGenerationError(message: str)
Bases: PydanticUserError
An error raised during failures to generate a CoreSchema for some type.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
message |
Description of the error. |
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
152 153 | |
PydanticInvalidForJsonSchema ¶
PydanticInvalidForJsonSchema(message: str)
Bases: PydanticUserError
An error raised during failures to generate a JSON schema for some CoreSchema.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
message |
Description of the error. |
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
163 164 | |
PydanticForbiddenQualifier ¶
PydanticForbiddenQualifier(qualifier: Qualifier, annotation: Any)
Bases: PydanticUserError
An error raised if a forbidden type qualifier is found in a type annotation.
Source code in .venv/lib/python3.13/site-packages/pydantic/errors.py
179 180 181 182 183 184 185 186 | |