Skip to content

Commit

Permalink
Fix inabilty to refresh tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
henworth committed May 13, 2021
1 parent bfb83fd commit e8f948b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion seraphsix/tasks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ async def execute_pydest(function, *args, **kwargs):

log.debug(f"{function} {args} {kwargs} - {data}")

# None is a valid value for return_type, in this case we don't try and turn it into
# a dataclass. This is primarily used for manifest decoding.
if not return_type:
return data

Expand All @@ -76,7 +78,13 @@ async def execute_pydest(function, *args, **kwargs):
else:
if not res:
raise RuntimeError("Unexpected empty response from the Destiny API")
if res.error_status != 'Success':

# DestinyTokenResponse and DestinyTokenErrorResponse have an "error" field
if hasattr(res, 'error') and res.error:
log.error(f"Error running {function} {args} {kwargs} - {res}")
raise RuntimeError(f"Error running {function} {args} {kwargs} - {res}")
elif hasattr(res, 'error_status') and res.error_status != 'Success':
# The rest of the API responses use "error_status"
# https://bungie-net.github.io/#/components/schemas/Exceptions.PlatformErrorCodes
if res.error_status == 'SystemDisabled':
raise MaintenanceError
Expand Down

0 comments on commit e8f948b

Please sign in to comment.