Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

rambobinator
Copy link
Collaborator

No description provided.

@@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Contributor

@ramnes ramnes Jul 31, 2019

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handlers*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants