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

[BUG] additional info missing from TransportError when using async #225

Closed
gg-kialo opened this issue Oct 26, 2022 · 1 comment · Fixed by #226
Closed

[BUG] additional info missing from TransportError when using async #225

gg-kialo opened this issue Oct 26, 2022 · 1 comment · Fixed by #226
Assignees
Labels
bug Something isn't working

Comments

@gg-kialo
Copy link
Contributor

What is the bug?

TransportErrors are missing the parsed json stored on the info property when using the library with async.

The cause is the content type is not being passed to _raise_errors from the async code.
See the difference between the sync code and the async code

How can one reproduce the bug?

Make bad requests (e.g. 400s) when using the async code.

What is the expected behavior?

TransportErrors info property should contain a dict with the parsed response (as in non-async use of the library).

What is your host/environment?

Linux + MacOs

Do you have any screenshots?

Links to code above.

Do you have any additional context?

This bug was introduced in 1.1.0 when the content-type header started to be inspected before parsing the json. 1cd15b0

@gg-kialo gg-kialo added bug Something isn't working untriaged Need triage labels Oct 26, 2022
@wbeckler
Copy link
Contributor

Nice catch. Feel free to offer a PR.

@wbeckler wbeckler removed the untriaged Need triage label Oct 26, 2022
gg-kialo added a commit to gg-kialo/opensearch-py that referenced this issue May 8, 2023
Passing the Content-Type to `_raise_errors` will cause the json body to
be parsed and included in the `TransportError`.

This matches the behaviour of the sync client.

Fixes opensearch-project#225

Signed-off-by: Gordon Govan <gg@kialo.com>
dblock pushed a commit that referenced this issue May 9, 2023
Passing the Content-Type to `_raise_errors` will cause the json body to
be parsed and included in the `TransportError`.

This matches the behaviour of the sync client.

Fixes #225

Signed-off-by: Gordon Govan <gg@kialo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants