From 5e6e12cacd01cee57dd30a30d52cb24fd3cdcd22 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Tue, 8 May 2018 15:21:54 -0700 Subject: [PATCH] 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. --- common/multistep_runner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/multistep_runner.go b/common/multistep_runner.go index 501e8b031..b34ee3a04 100644 --- a/common/multistep_runner.go +++ b/common/multistep_runner.go @@ -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...") @@ -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) {