Skip to content

Commit 827fba2

Browse files
authored
Add error logs (#879)
1 parent 6217009 commit 827fba2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/utils/httper/drive.go

+2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ func Unmount(mountPoint string) error {
9292
"mountPoint": mountPoint,
9393
}).Post("/mount/unmount")
9494
if err != nil {
95+
logger.Error("when unmount", zap.Error(err))
9596
return err
9697
}
9798
if res.StatusCode() != 200 {
99+
logger.Error("then unmount failed", zap.Any("res", res.Body()))
98100
return fmt.Errorf("unmount failed")
99101
}
100102
logger.Info("unmount then", zap.Any("res", res.Body()))

route/v1/storage.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ func DeleteStorage(c *gin.Context) {
8484
c.ShouldBind(&json)
8585
mountPoint := json["mount_point"]
8686
if mountPoint == "" {
87-
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.CLIENT_ERROR, Message: common_err.GetMsg(common_err.CLIENT_ERROR), Data: "mount_point is empty"})
87+
c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.CLIENT_ERROR, Message: common_err.GetMsg(common_err.CLIENT_ERROR), Data: "mount_point is empty"})
8888
return
8989
}
9090
err := service.MyService.Storage().UnmountStorage(mountPoint)
9191
if err != nil {
92-
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()})
92+
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()})
9393
return
9494
}
9595
service.MyService.Storage().DeleteConfigByName(strings.ReplaceAll(mountPoint, "/mnt/", ""))

0 commit comments

Comments
 (0)