Skip to content

Commit

Permalink
Merge pull request #50 from paul-florentin-charles/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
paul-florentin-charles committed Nov 29, 2023
2 parents 3a57a30 + 40e1a76 commit aa823e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/error_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def bad_request(message: str) -> Response:
"""

return make_response(
ApiError().dump({"name": HTTPStatus.BAD_REQUEST.phrase, "message": message}),
ApiError().dump({"message": message}),
HTTPStatus.BAD_REQUEST.value,
)
6 changes: 5 additions & 1 deletion src/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class YearsAboveOrBelowNormalSchema(BaseSchema):


class ApiError(Schema):
"""
Generic schema to depict any error.
"""

code: int = fields.Int(dump_default=HTTPStatus.BAD_REQUEST.value)
name: str = fields.Str()
name: str = fields.Str(dump_default=HTTPStatus.BAD_REQUEST.phrase)
message: str = fields.Str()
4 changes: 2 additions & 2 deletions tst/core/utils/enums/test_time_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
def test_time_modes() -> None:
assert len(TimeMode) == 3

for time_mode in TimeMode:
assert isinstance(time_mode.value, str)
for t_mode in TimeMode.values():
assert isinstance(t_mode, str)

0 comments on commit aa823e4

Please sign in to comment.