Better error handling for GCS credential argument addition

Signed-off-by: Andrey Kostov <kostov.andrey@gmail.com>
This commit is contained in:
Andrey Kostov 2016-08-15 14:35:18 -07:00 committed by Ryan Abrams
parent 3f9f073cef
commit b424c3d870

View file

@ -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