Skip to content

Commit

Permalink
Better error handling for GCS credential argument addition
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Kostov <[email protected]>
  • Loading branch information
AndreyKostov authored and caervs committed Sep 5, 2018
1 parent 3f9f073 commit b424c3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion registry/storage/driver/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,16 @@ func FromParameters(parameters map[string]interface{}) (storagedriver.StorageDri
for k, v := range credentialMap {
key, ok := k.(string)
if !ok {
return nil, fmt.Errorf("One of the credential keys was not a string")
return nil, fmt.Errorf("One of the credential keys was not a string: %s", fmt.Sprint(k))
}
stringMap[key] = v
}

data, err := json.Marshal(stringMap)
if err != nil {
return nil, fmt.Errorf("Failed to marshal gcs credentials to json")
}

jwtConf, err := google.JWTConfigFromJSON(data, storage.ScopeFullControl)
if err != nil {
return nil, err
Expand Down

0 comments on commit b424c3d

Please sign in to comment.