Skip to content

🐛(validation) replace TypeErrors with ValueErrors#632

Open
piptouque wants to merge 1 commit into
openfun:mainfrom
piptouque:fix_validation_type_error
Open

🐛(validation) replace TypeErrors with ValueErrors#632
piptouque wants to merge 1 commit into
openfun:mainfrom
piptouque:fix_validation_type_error

Conversation

@piptouque

@piptouque piptouque commented Jun 15, 2026

Copy link
Copy Markdown

Purpose

[TypeErrors are not supported as validation errors by Pydantic](https://pydantic.dev/docs/validation/latest/concepts/validators/ #raising-validation-errors).
So Pydantic won't encapsulate them in a ValidationError.

Proposal

We replace them with ValueErrors, which work as expected.

  • Replaced TypeErrors with ValueErrors in Pydantic models
  • Updated tests
  • Updated CHANGELOG.md

`TypeError`s are not supported as validation errors by Pydantic:
it won't encapsulate them in a ValidationError.
We replace them with `ValueError`s, which work
as expected.

see: https://pydantic.dev/docs/validation/latest/concepts/validators/
\#raising-validation-errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant