From 8da9ef2b0382fffaf9953a40d947a96653707246 Mon Sep 17 00:00:00 2001 From: Nolan Brubaker Date: Mon, 9 Sep 2019 10:22:00 -0400 Subject: [PATCH] Make GCP credentials parsing errors less ambiguous (#1850) A user encountered the following error on a GCP project: An error occurred: some backup storage locations are invalid: error getting backup store for location "default": rpc error: code = Unknown desc = invalid character '-' in numeric literal This error was ambiguous and took some time to track down to the fact that their credentials file wasn't a JSON file, but instead the contents of the private key field. This change makes the problem slightly easier to debug. Signed-off-by: Nolan Brubaker --- pkg/cloudprovider/gcp/object_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cloudprovider/gcp/object_store.go b/pkg/cloudprovider/gcp/object_store.go index 766c8f12b..e3d3ebacb 100644 --- a/pkg/cloudprovider/gcp/object_store.go +++ b/pkg/cloudprovider/gcp/object_store.go @@ -83,7 +83,7 @@ func (o *ObjectStore) Init(config map[string]string) error { } jwtConfig, err := google.JWTConfigFromJSON(creds) if err != nil { - return errors.WithStack(err) + return errors.Wrap(err, "error parsing credentials file; should be JSON") } if jwtConfig.Email == "" { return errors.Errorf("credentials file pointed to by %s does not contain an email", credentialsEnvVar)