Skip to content
masterclass Buddy

Pydantic · Error

PydanticCustomError

PydanticCustomError lets a custom validator create a validation error with its own type, message template, and context. Use it when you need more control over the error details.

Last updated

Syntax

PydanticCustomError(error_type, message_template, context=None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • PydanticKnownError
  • ValidationError
  • field_validator
  • ErrorDetails

Source: Pydantic Core. Checked 2026-11-03.