Better error handling for GCS credential argument addition
Signed-off-by: Andrey Kostov <kostov.andrey@gmail.com>
This commit is contained in:
parent
3f9f073cef
commit
b424c3d870
1 changed files with 5 additions and 1 deletions
|
@ -151,12 +151,16 @@ func FromParameters(parameters map[string]interface{}) (storagedriver.StorageDri
|
||||||
for k, v := range credentialMap {
|
for k, v := range credentialMap {
|
||||||
key, ok := k.(string)
|
key, ok := k.(string)
|
||||||
if !ok {
|
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
|
stringMap[key] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(stringMap)
|
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)
|
jwtConf, err := google.JWTConfigFromJSON(data, storage.ScopeFullControl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue