Skip to content

Commit

Permalink
update with "4XX" and "5XX"
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Jul 11, 2024
1 parent 2fb6f51 commit ba3a24d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/galaxy/webapps/base/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,15 @@ def add_request_id_middleware(app: FastAPI):

def include_all_package_routers(app: FastAPI, package_name: str):
responses: typing.Dict[typing.Union[int, str], typing.Dict[str, typing.Any]] = {
422: {
"description": "Validation error",
"4XX": {
"description": "Client Error",
"model": MessageExceptionModel,
},
}
for code, error in error_codes_by_int_code.items():
code_int = int(str(code)[:3])
if code_int in [0, 204] or code_int in responses:
continue
responses[code_int] = {
"description": str(error),
"5XX": {
"description": "Server Error",
"model": MessageExceptionModel,
}
},
}
for _, module in walk_controller_modules(package_name):
router = getattr(module, "router", None)
if router:
Expand Down

0 comments on commit ba3a24d

Please sign in to comment.