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

Standardize https driver errors on consistent detailed response #12

Open
sfc-gh-afedorov opened this issue Jun 2, 2021 · 0 comments
Open

Comments

@sfc-gh-afedorov
Copy link
Collaborator

Right now, the different errors that can come out of the HTTPS driver are not consistent in the keys they return, nor do they have a lot of details to help someone debug, forcing them in some cases to use curl side-by-side when the EF could just return more helpful details, instead.

The HTTPError was fixed in a soon-to-be-discarded branch here by changing that except block to —

        except HTTPError as e:
            content_type = e.headers.get('Content-Type')
            response_body = e.read().decode()
            result = {
                'error': 'HTTPError',
                'url': next_url,
                'status': e.status,
                'reason': e.reason,
                'body': (
                    loads(response_body)
                    if content_type.startswith('application/json')
                    else response_body
                ),
            }

We want to migrate that code and also standardize the other errors on having a subset of keys {"error", "url", "status", "reason", "body"}.

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

No branches or pull requests

1 participant