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:
parent
0a1842140b
commit
5e6e12cacd
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue