Skip to content

Commit

Permalink
Merge pull request #1409 from actiontech/issue-1328
Browse files Browse the repository at this point in the history
make message readable
  • Loading branch information
taolx0 authored Mar 30, 2023
2 parents bc712b6 + 9ead98e commit b993ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sqle/api/controller/v1/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func DeleteInstance(c echo.Context) error {
}

if err = common.CheckDeleteInstance(instance.ID); err != nil {
return controller.JSONBaseErrorReq(c, err)
return controller.JSONBaseErrorReq(c, fmt.Errorf("%v can't be deleted. Cause: %v", instance.Name, err))
}

if err := s.DeleteInstance(instance); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions sqle/common/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"context"
"errors"
"fmt"

"github.com/actiontech/sqle/sqle/log"
Expand All @@ -27,10 +28,10 @@ func CheckDeleteInstance(instanceId uint) error {

isUnFinished, err := s.IsWorkflowUnFinishedByInstanceId(instanceId)
if err != nil {
return fmt.Errorf("check instance %d is finished failed: %v", instanceId, err)
return fmt.Errorf("check if all workflows are finished failed: %v", err)
}
if isUnFinished {
return fmt.Errorf("instance %d is running,cannot be deleted", instanceId)
return errors.New("has unfinished workflows")
}

return nil
Expand Down

0 comments on commit b993ce0

Please sign in to comment.