Skip to content

Conversation

@huanggze
Copy link

@huanggze huanggze commented Apr 2, 2020

Signed-off-by: huanggze loganhuang@yunify.com

The current way we handle error drops some info from errorType and error for some scenarios.

Consider a real response example below, we expect the error object carry more info than inconsistent body for response code.

HTTP OK --- { "status":"error", "errorType":"internal", "error":"multiple matches for labels: many-to-one matching must be explicit (group_left/group_right)" }
@huanggze
Copy link
Author

huanggze commented Apr 2, 2020

@huanggze huanggze changed the title Improve error handling Improve API error handling Apr 2, 2020
Signed-off-by: huanggze <loganhuang@yunify.com>
@beorn7
Copy link
Member

beorn7 commented Apr 2, 2020

@bboreham @joe-elliott you might have most context here. Does this make sense?

@beorn7 beorn7 self-requested a review April 2, 2020 11:00
@joe-elliott
Copy link
Contributor

Without knowing the details of prometheus's API response code it's hard to say definitively, but I do prefer the changes @huanggze has made to the existing code.

With these changes the error is only hardcoded to "inconsistent body for response code" if the body says "success" but the http status is error. Otherwise you always get the error as returned from prometheus which I like.

Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, everyone. This makes sense to me, too, from my limited understanding. (o:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants