backends: remove log.Fatal and replace with error returns #5234

This changes the Config interface so that it returns an error.
This commit is contained in:
Nick Craig-Wood
2021-04-27 18:18:08 +01:00
parent ef3c350686
commit b78c9a65fa
28 changed files with 179 additions and 166 deletions
+3 -3
View File
@@ -11,7 +11,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"time"
@@ -56,11 +55,12 @@ func init() {
Name: "hubic",
Description: "Hubic",
NewFs: NewFs,
Config: func(ctx context.Context, name string, m configmap.Mapper) {
Config: func(ctx context.Context, name string, m configmap.Mapper) error {
err := oauthutil.Config(ctx, "hubic", name, m, oauthConfig, nil)
if err != nil {
log.Fatalf("Failed to configure token: %v", err)
return errors.Wrap(err, "failed to configure token")
}
return nil
},
Options: append(oauthutil.SharedOptions, swift.SharedOptions...),
})