Skip to content

Commit

Permalink
Revert exclude_none=True, exclude_unset=True, exclude_defaults=True
Browse files Browse the repository at this point in the history
… in error serialization.

`exclude_unset=True` and `exclude_defaults=True` do not do what we want because we define a lot of fields like `errorType: Literal["RunNotFoundError"] = "RunNotFoundError"`, and we definitely do want those to get serialized. The bug that was fixed in commit b5b28b6 was somehow covering up this problem, I think.

I'm ambivalent about `exclude_none=True` here, but I don't see a pressing reason for this upgrade to change it from what it was before, so let's delete that too.
  • Loading branch information
SyntaxColoring committed Dec 10, 2024
1 parent 6bd2223 commit 3414714
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions robot-server/robot_server/errors/error_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ class BaseErrorBody(BaseResponseBody):

def as_error(self, status_code: int) -> ApiError:
"""Serialize the response as an API error to raise in a handler."""
return ApiError(
status_code=status_code,
content=self.model_dump(
exclude_none=True, exclude_unset=True, exclude_defaults=True
),
)
return ApiError(status_code=status_code, content=self.model_dump())


class ErrorSource(BaseModel):
Expand Down

0 comments on commit 3414714

Please sign in to comment.