Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle error in rollback
Browse files Browse the repository at this point in the history
If the rollback fails, the error was not handled properly, since the value of response is undefined.
taukakao committed Dec 12, 2024
1 parent 61a724d commit 4cc0281
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/rollback.go
Original file line number Diff line number Diff line change
@@ -61,6 +61,11 @@ func rollback(cmd *cobra.Command, args []string) error {
}

response, err := aBsys.Rollback(checkOnly)
if err != nil {
cmdr.Error.Println(err)
os.Exit(2)
return err
}
switch response {
case core.ROLLBACK_RES_YES:
// NOTE: the following strings could lead to misinterpretation, with
@@ -77,10 +82,6 @@ func rollback(cmd *cobra.Command, args []string) error {
case core.ROLLBACK_SUCCESS:
cmdr.Info.Println(abroot.Trans("rollback.rollbackSuccess"))
os.Exit(0)
case core.ROLLBACK_FAILED:
cmdr.Info.Println(abroot.Trans("rollback.rollbackFailed", err))
os.Exit(1)
return err
}

return nil

0 comments on commit 4cc0281

Please sign in to comment.