Skip to content

Commit

Permalink
rollback if nsc url is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
sethjback committed Jan 25, 2023
1 parent 7d2a8c9 commit 9e5ef18
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cli/context_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ func (c *ctxCommand) editCommand(pc *fisk.ParseContext) error {
return err
}

return c.showCommand(pc)
// There was an error with some data in the modified config
// Save the known clean version and show the error
err = c.showCommand(pc)
if err != nil {
ctx.Save(c.name)
return err
}

return nil
}

func (c *ctxCommand) renderListCompletion(current string, known []*natscontext.Context) {
Expand Down

0 comments on commit 9e5ef18

Please sign in to comment.