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

Update error message for invalid api response #52

Merged
merged 4 commits into from
Mar 13, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (c *Client) do(ctx context.Context, req *http.Request, ret interface{}) err
}
if err := json.Unmarshal(body, ret); err != nil {
// We received a success response from the ES API but the body was in an unexpected format.
return fmt.Errorf("%s; %d: %s", err, resp.StatusCode, body)
return fmt.Errorf("unexpected format from elasticsearch api:%s; %d", err, resp.StatusCode)
mickael-hc marked this conversation as resolved.
Show resolved Hide resolved
}
// Body has been successfully read out.
return nil
Expand All @@ -250,5 +250,5 @@ func (c *Client) do(ctx context.Context, req *http.Request, ret interface{}) err
}

// We received some sort of API error. Let's return it.
return fmt.Errorf("%d: %s", resp.StatusCode, body)
return fmt.Errorf("error returned from elasticsearchapi: %d", resp.StatusCode)
mickael-hc marked this conversation as resolved.
Show resolved Hide resolved
}