Skip to content

Commit 7eb864d

Browse files
committed
fix: handle error when creating new qiniu client in migration and upload processes
Signed-off-by: tbxark <[email protected]>
1 parent 1c0ad37 commit 7eb864d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

layout/cmd/cli/storage/cmd/migrate.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ func runMigrate(cmd *cobra.Command, args []string) {
4848
if err != nil {
4949
log.Panicf("load config error: %v", err)
5050
}
51-
upload := qiniu.NewClient(cfg.Storage)
51+
upload, err := qiniu.NewClient(cfg.Storage)
52+
if err != nil {
53+
log.Panicf("new qiniu client error: %v", err)
54+
}
5255
list := strings.Split(string(file), "\n")
5356
ctx := context.Background()
5457
result := make(map[string]string, len(list))

layout/cmd/cli/storage/cmd/upload.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ func runUpload(cmd *cobra.Command, args []string) {
4141
log.Panicf("load config error: %v", err)
4242
}
4343

44-
upload := qiniu.NewClient(cfg.Storage)
44+
upload, err := qiniu.NewClient(cfg.Storage)
45+
if err != nil {
46+
log.Panicf("new qiniu client error: %v", err)
47+
}
4548
ctx := context.Background()
4649
resBuf := strings.Builder{}
4750
nameBuilder := storage.KeepFileNameKeyBuilder()

0 commit comments

Comments
 (0)