Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show error message when -on-error=[ask|abort] #6253

Merged
merged 3 commits into from
May 8, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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.
  • Loading branch information
mwhooker committed May 8, 2018
commit 5e6e12cacd01cee57dd30a30d52cb24fd3cdcd22
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