Skip to content

Commit

Permalink
Don't use include_url with Pydantic's V1 ValidationError (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored May 15, 2024
1 parent 3a9c7bf commit 63a9c96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion logfire/_internal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,11 @@ def _record_exception(
attributes = {**(attributes or {})}
if ValidationError is not None and isinstance(exception, ValidationError):
# insert a more detailed breakdown of pydantic errors
err_json = exception.json(include_url=False)
try:
err_json = exception.json(include_url=False)
except TypeError: # pragma: no cover
# pydantic v1
err_json = exception.json()
span.set_attribute(ATTRIBUTES_VALIDATION_ERROR_KEY, err_json)
attributes[ATTRIBUTES_VALIDATION_ERROR_KEY] = err_json

Expand Down

0 comments on commit 63a9c96

Please sign in to comment.