Skip to content

Commit

Permalink
fix: raises exception when a 404 is encountered
Browse files Browse the repository at this point in the history
the api raises a 404 if an object isn't found when trying to get
particular objects, since making the _get method generic so it's
reusable across various other objects, it was missing handling the 404
exception, this covers that.

Note that the list methods will probably ignore this but it's as valid
to include the exception handling in the fetch
  • Loading branch information
devraj committed May 6, 2024
1 parent 5e8a486 commit ed512f5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gallagher/cc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ async def _get(

return parsed_obj

elif response.status_code == HTTPStatus.NOT_FOUND:
raise NotFoundException()
elif response.status_code == HTTPStatus.FORBIDDEN:
raise UnlicensedFeatureException()
elif response.status_code == HTTPStatus.UNAUTHORIZED:
Expand Down

0 comments on commit ed512f5

Please sign in to comment.