Skip to content

Commit 6070417

Browse files
authored
fix: subtask plugin exec error's return (#122)
Signed-off-by: William Poussier <[email protected]>
1 parent dd522b7 commit 6070417

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/plugins/builtin/subtask/subtask.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package pluginsubtask
33
import (
44
"context"
55
"fmt"
6+
"strings"
67

78
"github.com/juju/errors"
89
"github.com/loopfz/gadgeto/zesty"
@@ -132,9 +133,9 @@ func exec(stepName string, config interface{}, ctx interface{}) (interface{}, in
132133
switch t.State {
133134
case task.StateDone:
134135
stepError = nil
135-
case task.StateCancelled:
136-
// stop retrying if subtask was cancelled
137-
stepError = errors.BadRequestf("Task '%s' was cancelled", t.PublicID)
136+
case task.StateCancelled, task.StateWontfix, task.StateBlocked:
137+
// Stop retrying the subtask.
138+
stepError = errors.BadRequestf("Task '%s' changed state: %s", t.PublicID, strings.ToLower(t.State))
138139
default:
139140
// keep step running while subtask is not done
140141
// FIXME, use proper error type

0 commit comments

Comments
 (0)