There was an error while loading. Please reload this page.
1 parent a791a29 commit e30a778Copy full SHA for e30a778
1 file changed
exca/helpers.py
@@ -367,9 +367,10 @@ def _inject_type_on_serialization(
367
) -> dict[str, tp.Any]:
368
result: dict[str, tp.Any] = handler(self)
369
key = self._exca_discriminator_key
370
+ name = self.__class__.__name__
371
if key in result:
- raise ValueError("Cannot use field {key!r}. It is reserved.")
372
- result[key] = f"{self.__class__.__name__}"
+ raise ValueError(f"Cannot use field {key!r} in {self.__class__}, it is reserved.")
373
+ result[key] = name
374
return result
375
376
@pydantic.model_validator(mode="wrap") # noqa # the decorator position is correct
0 commit comments