Skip to content

Commit

Permalink
Use fmt to convert whatever's in error to a string.
Browse files Browse the repository at this point in the history
This way we don't crash if someone sticks something else in the error
key in the state bag (which a quick glance at the code tells me we're
already doing.

Perhaps in the future we can add an error attribute to the state bag
but for now this will have to suffice.
  • Loading branch information
mwhooker committed May 8, 2018
1 parent 0a18421 commit 5e6e12c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/multistep_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s abortStep) Run(ctx context.Context, state multistep.StateBag) multistep.
func (s abortStep) Cleanup(state multistep.StateBag) {
err, ok := state.GetOk("error")
if ok {
s.ui.Error(err.(error).Error())
s.ui.Error(fmt.Sprintf("%s", err))
}
if _, ok := state.GetOk(multistep.StateCancelled); ok {
s.ui.Error("Interrupted, aborting...")
Expand Down Expand Up @@ -105,7 +105,7 @@ func (s askStep) Run(ctx context.Context, state multistep.StateBag) (action mult

err, ok := state.GetOk("error")
if ok {
s.ui.Error(err.(error).Error())
s.ui.Error(fmt.Sprintf("%s", err))
}

switch ask(s.ui, typeName(s.step), state) {
Expand Down

0 comments on commit 5e6e12c

Please sign in to comment.