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

[Fix] Do not hide error on http failure #11604

Merged
merged 4 commits into from
Apr 8, 2019

Conversation

michalpristas
Copy link
Contributor

Just small re-ordering.
When http.Do call fails inside elasticsearch.client.execHTTPRequest it returns statusCode 0 and error.

This is swallowed by check status != OK resulting in a message error from the server, response code:0.
The real reason behind this failure is hidden and not even logged.

This PR checks for error before checking for status != ok so in a case when an error is provided, it is logged in another case, we're just logging that status is not OK.

I guess err will not be set when status is 200 anyways, but I left the check there

@michalpristas michalpristas merged commit 9df4a68 into elastic:master Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants