Skip to content

Commit

Permalink
Handle more error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenecal committed Mar 7, 2023
1 parent 077f0c5 commit c9395d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion regrws/api/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def _do(
from regrws.api.core import Session
from regrws.models import Error

with Session({200: return_type or self.model, 400: Error, 404: Error}) as session:
handlers = {200: return_type or self.model}
handlers.update({i: Error for i in [400, 401, 403, 404, 405, 406, 409]})
with Session(handlers) as session: # type: ignore
session_method = getattr(session, verb)
res: Response = session_method(
url, params=self.url_params, data=data
Expand Down

0 comments on commit c9395d4

Please sign in to comment.