Skip to content
Merged
Changes from all commits
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
16 changes: 9 additions & 7 deletions pkg/common/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,15 @@ func (e Executor) IfBool(conditional bool) Executor {

// Finally adds an executor to run after other executor
func (e Executor) Finally(finally Executor) Executor {
return func(ctx context.Context) error {
err := e(ctx)
err2 := finally(ctx)
if err2 != nil {
return fmt.Errorf("Error occurred running finally: %v (original error: %v)", err2, err)
}
return err
return func(ctx context.Context) (err error) {
defer func() {
err2 := finally(ctx)
if err2 != nil {
err = fmt.Errorf("Error occurred running finally: %v (original error: %v)", err2, err)
}
}()
err = e(ctx)
return
}
}

Expand Down
Loading