Skip to content

Commit

Permalink
Delete context from pydantic error messages
Browse files Browse the repository at this point in the history
Pydantic 2 improved error messages -> there is
a lot of duplication between the actual message
and the context.

Signed-off-by: Michal Šoltis <[email protected]>
  • Loading branch information
slimreaper35 authored and chmeliik committed Oct 10, 2023
1 parent 52a2172 commit 420a38a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cachi2/core/models/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ def _present_user_input_error(validation_error: pydantic.ValidationError) -> str

def show_error(error: "ErrorDict") -> str:
location = " -> ".join(map(str, error["loc"]))
context = "; ".join(f"{k}={v}" for k, v in error.get("ctx", {}).items())
message = error["msg"]

if context:
message = f"{message} ({context})"

if location != "__root__":
message = f"{location}\n {message}"

Expand Down

0 comments on commit 420a38a

Please sign in to comment.