Skip to content

Commit 0499699

Browse files
committed
handle error in rollback
If the rollback fails, the error was not handled properly, since the value of response is undefined.
1 parent 61a724d commit 0499699

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/rollback.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func rollback(cmd *cobra.Command, args []string) error {
6161
}
6262

6363
response, err := aBsys.Rollback(checkOnly)
64+
if err != nil {
65+
cmdr.Error.Println(err)
66+
os.Exit(2)
67+
return err
68+
}
6469
switch response {
6570
case core.ROLLBACK_RES_YES:
6671
// NOTE: the following strings could lead to misinterpretation, with
@@ -77,10 +82,6 @@ func rollback(cmd *cobra.Command, args []string) error {
7782
case core.ROLLBACK_SUCCESS:
7883
cmdr.Info.Println(abroot.Trans("rollback.rollbackSuccess"))
7984
os.Exit(0)
80-
case core.ROLLBACK_FAILED:
81-
cmdr.Info.Println(abroot.Trans("rollback.rollbackFailed", err))
82-
os.Exit(1)
83-
return err
8485
}
8586

8687
return nil

0 commit comments

Comments
 (0)