pydantic_settings.errors

Module Contents

exception pydantic_settings.errors.LoadingError(file_path: Optional[Path], cause: Exception = None, msg: str = None)

General loading error.

file_path :Optional[Path]

Source file path, or none if in-memory string used

cause :Optional[Exception]

Cause of error (used instead of __cause__ attribute)

msg :Optional[str]

Optional error message

render_error(self) → str

Render error as a human-readable text

Returns

rendered text string

exception pydantic_settings.errors.LoadingParseError(*args: Any, decoder: DecoderMeta = None, location: TextLocation = None, **kwargs)

Parsing error occurs while load.

render_error(self) → str

Render error as a human-readable text

Returns

rendered text string

exception pydantic_settings.errors.LoadingValidationError(raw_errors: Sequence[ErrorWrapper], model: Type[BaseModel], file_path: Optional[Path])

Joins pydantic.ValidationError and LoadingError, primarily to allow catching specific for load_settings() function errors at once.

errors(self) → List[Dict[str, Any]]
render_error(self) → str

Render error as a human-readable text

Returns

rendered text string

class pydantic_settings.errors.ExtendedErrorWrapper(exc: Exception, loc: JsonLocation, source_loc: AnySourceLocation = None)

Extends pydantic.ErrorWrapper adding fields used to locate bad filed value inside source text or environment variables.

source_loc :AnySourceLocation

Describes source location, corresponding to pydantic.ErrorWrapper.loc.

pydantic_settings.errors.with_errs_locations(model: Type[BaseModel], validation_err: ValidationError, values_source: AnySourceLocProvider) → ValidationError
pydantic_settings.errors.serialize_errors(err: ValidationError, config: Type[BaseConfig]) → List[Json]
pydantic_settings.errors.render_validation_error(error: LoadingValidationError) → str