Use fmt to convert whatever's in error to a string.

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.
This commit is contained in:
Matthew Hooker 2018-05-08 15:21:54 -07:00
parent 0a1842140b
commit 5e6e12cacd
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ func (s abortStep) Run(ctx context.Context, state multistep.StateBag) multistep.
func (s abortStep) Cleanup(state multistep.StateBag) { func (s abortStep) Cleanup(state multistep.StateBag) {
err, ok := state.GetOk("error") err, ok := state.GetOk("error")
if ok { if ok {
s.ui.Error(err.(error).Error()) s.ui.Error(fmt.Sprintf("%s", err))
} }
if _, ok := state.GetOk(multistep.StateCancelled); ok { if _, ok := state.GetOk(multistep.StateCancelled); ok {
s.ui.Error("Interrupted, aborting...") s.ui.Error("Interrupted, aborting...")
@ -105,7 +105,7 @@ func (s askStep) Run(ctx context.Context, state multistep.StateBag) (action mult
err, ok := state.GetOk("error") err, ok := state.GetOk("error")
if ok { if ok {
s.ui.Error(err.(error).Error()) s.ui.Error(fmt.Sprintf("%s", err))
} }
switch ask(s.ui, typeName(s.step), state) { switch ask(s.ui, typeName(s.step), state) {