Skip to content

Commit 92ecb1c

Browse files
committed
better error output for dynamic variables in Taskvars.yml
1 parent 645f77b commit 92ecb1c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

errors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,12 @@ type cantWatchNoSourcesError struct {
5252
func (err *cantWatchNoSourcesError) Error() string {
5353
return fmt.Sprintf(`task: Can't watch task "%s" because it has no specified sources`, err.taskName)
5454
}
55+
56+
type dynamicVarError struct {
57+
cause error
58+
cmd string
59+
}
60+
61+
func (err *dynamicVarError) Error() string {
62+
return fmt.Sprintf(`task: Command "%s" in taskvars file failed: %s`, err.cmd, err.cause)
63+
}

variable_handling.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (e *Executor) handleDynamicVariableContent(value string) (string, error) {
4141
Stderr: e.Stderr,
4242
}
4343
if err := execext.RunCommand(opts); err != nil {
44-
return "", err
44+
return "", &dynamicVarError{cause: err, cmd: opts.Command}
4545
}
4646

4747
result := buff.String()

0 commit comments

Comments
 (0)