Skip to content

Commit

Permalink
Fix bug when trying to parse an integer in the 'Code' or 'code' part …
Browse files Browse the repository at this point in the history
…of the response body
  • Loading branch information
jonathan343 committed Feb 26, 2025
1 parent 9cdcc08 commit 6ed4a7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions botocore/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,12 +1316,11 @@ def _inject_error_code(self, error, response):
code = response['headers']['x-amzn-errortype']
elif 'code' in body or 'Code' in body:
code = body.get('code', body.get('Code', ''))
if code is not None:
if ':' in code:
code = code.split(':', 1)[0]
if '#' in code:
code = code.rsplit('#', 1)[1]
error['Error']['Code'] = code
if code is None:
return
if isinstance(code, str):
code = code.split(':', 1)[0].rsplit('#', 1)[-1]
error['Error']['Code'] = code

def _handle_boolean(self, shape, value):
return ensure_boolean(value)
Expand Down
Empty file added testing.py
Empty file.

0 comments on commit 6ed4a7d

Please sign in to comment.