Skip to content

Commit

Permalink
feat: make missing scope exceptions more verbose (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceAesth authored Jan 25, 2024
1 parent a26212b commit bfe1d3a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aiosu/v2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,15 @@ async def _wrap(self: Client, *args: Any, **kwargs: Any) -> object:
token = await self.get_current_token()
if any_scope:
if not (required_scopes & token.scopes):
raise APIException(403, "Missing required scopes.")
raise APIException(
403,
f"Missing required scopes. Required: '{required_scopes}', Got: '{token.scopes}'",
)
elif required_scopes & token.scopes != required_scopes:
raise APIException(403, "Missing required scopes.")
raise APIException(
403,
f"Missing required scopes. Required: '{required_scopes}', Got: '{token.scopes}'",
)

return await func(self, *args, **kwargs)

Expand Down

0 comments on commit bfe1d3a

Please sign in to comment.