-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Error handling rework #38
base: master
Are you sure you want to change the base?
Conversation
@@ -77,6 +74,7 @@ def _send(self, send_method, service_name, data=None, **kwargs): | |||
""" | |||
valid_response = False | |||
raw = kwargs.pop("raw", False) | |||
custom_exception_handlers = kwargs.pop("custom_exception_handlers") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom_exception_handlers = kwargs.pop("custom_exception_handlers") | |
custom_exception_handlers = kwargs.pop("custom_exception_handlers", None) |
raise self.error_codes[error_code](response) | ||
if "error_code" in data or "error_id" in data: | ||
raise AppNexusException(response) | ||
raise type(data["error_id"], (AppNexusException,), {})(response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to create a new type if we catch it right after. Let's remove that method and check the "error_id" directly in an handle_errors
method.
|
||
def _exception_handler(self, exception, | ||
response, data, | ||
custom_handler=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handlers*
No description provided.