Skip to content

Commit

Permalink
chore: ensures integer in error code
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jan 4, 2024
1 parent e7867eb commit df569c8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mvc/src/mvc_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ def decorator_interceptor(*args, **kwargs):
status_code = exception.status_code if\
has_status_code else ERROR_STATUS_CODE

# tries to cast the status code as an integer defaulting
# in case it fails to the default error status code
try: status_code = int(status_code)
except Exception: status_code = ERROR_STATUS_CODE

# sets the error status code in the current request indicating
# that a problem has occurred (default behavior)
self.set_status_code(request, status_code)
Expand Down

0 comments on commit df569c8

Please sign in to comment.