remote: Allow unwrapping of errors when reading from remote client#16437
remote: Allow unwrapping of errors when reading from remote client#16437krajorama merged 4 commits intoprometheus:mainfrom
Conversation
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
krajorama
left a comment
There was a problem hiding this comment.
lgtm, we checked that the original code also has the "\n" in the message, see expectedErrorContains in the test.
bboreham
left a comment
There was a problem hiding this comment.
Seems ok, but wouldn't it be even better to wrap a special error type, so you know what kind of thing you unwrapped?
|
Thank you both! We use this to unwrap errors to summarise them in a downstream project, so if multiple targets fail with the same error we can have a more concise summary, e.g. an error that was like |
When
fmt.Errorfuses only %s and no %w, it can't be unwrapped, but when it does, it can be unwrapped to just the %w part.This change allows us to unwrap the error we get from here, so previously an error like
remote_read: remote server http://127.0.0.1:45687/api/v1/read returned http status 500 Internal Server Error: execution errorcouldn't be unwrapped, but now it can be unwrapped to justexecution error.