You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[improvement] Wrap HTTPError in ConjureHTTPError with SerializableError details (#22)
<!-- PR title should start with '[fix]', '[improvement]' or '[break]' if this PR would cause a patch, minor or major SemVer bump. Omit the prefix if this PR doesn't warrant a standalone release. -->
## Before this PR
<!-- Describe the problem you encountered with the current state of the world (or link to an issue) and why it's important to fix now. -->
`HTTPError` response content was parsed hoping to find `SerializableError` contents, though didn't extract all contents and relied on deprecated fields such as message. The original `HTTPError` and a message were then wrapped in a new `HTTPError` and reraised.
## After this PR
<!-- Describe at a high-level why this approach is better. -->
1. The original `HTTPError` is wrapped in a way (`raise_from`) that is understandable to Python 3's improved traceback functionality.
2. The new `ConjureHTTPError` can be separately detected as such while maintaining a reference to its wrapped `cause`.
3. The new `ConjureHTTPError` contains attributes to access fields from `SerializableError`, as well as the `X-B3-TraceId` from response headers when possible.
<!-- Reference any existing GitHub issues, e.g. 'fixes #000' or 'relevant to #000' -->
See also #21.
0 commit comments