mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Handle wrapped errors (#29223)
* Chore: Handle wrapped errors Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package grpcplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@@ -143,11 +144,11 @@ func (c *clientV2) CallResource(ctx context.Context, req *backend.CallResourceRe
|
||||
return backendplugin.ErrMethodNotImplemented
|
||||
}
|
||||
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return errutil.Wrap("Failed to receive call resource response", err)
|
||||
return errutil.Wrap("failed to receive call resource response", err)
|
||||
}
|
||||
|
||||
if err := sender.Send(backend.FromProto().CallResourceResponse(protoResp)); err != nil {
|
||||
|
||||
@@ -313,7 +313,7 @@ func flushStream(plugin Plugin, stream CallResourceClientResponseStream, w http.
|
||||
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
if processedStreams == 0 {
|
||||
return errors.New("received empty resource response")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user