From 5e9b6741ff5f927fd81f4b1224cf5e4c918daab8 Mon Sep 17 00:00:00 2001 From: Marc Guasch Date: Mon, 21 Dec 2020 12:20:19 +0100 Subject: [PATCH] Make error more descriptive and reorder imports --- x-pack/filebeat/input/gcppubsub/input.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x-pack/filebeat/input/gcppubsub/input.go b/x-pack/filebeat/input/gcppubsub/input.go index c59c02c48d5..d71af4bb2d4 100644 --- a/x-pack/filebeat/input/gcppubsub/input.go +++ b/x-pack/filebeat/input/gcppubsub/input.go @@ -12,11 +12,10 @@ import ( "sync" "time" - "google.golang.org/grpc" - "cloud.google.com/go/pubsub" "github.com/pkg/errors" "google.golang.org/api/option" + "google.golang.org/grpc" "github.com/elastic/beats/v7/filebeat/channel" "github.com/elastic/beats/v7/filebeat/input" @@ -253,7 +252,7 @@ func (in *pubsubInput) newPubsubClient(ctx context.Context) (*pubsub.Client, err // this will be typically set because we want to point the input to a testing pubsub emulator conn, err := grpc.Dial(in.AlternativeHost, grpc.WithInsecure()) if err != nil { - return nil, fmt.Errorf("grpc.Dial: %w", err) + return nil, fmt.Errorf("cannot connect to alternative host %q: %w", in.AlternativeHost, err) } opts = append(opts, option.WithGRPCConn(conn), option.WithTelemetryDisabled()) }