From 92ecb1c7ec6212b6611b75f6424152b080bae0e8 Mon Sep 17 00:00:00 2001 From: Rene Zbinden Date: Fri, 7 Jul 2017 08:33:56 +0200 Subject: [PATCH] better error output for dynamic variables in Taskvars.yml --- errors.go | 9 +++++++++ variable_handling.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index 82c701b0..bb207674 100644 --- a/errors.go +++ b/errors.go @@ -52,3 +52,12 @@ type cantWatchNoSourcesError struct { func (err *cantWatchNoSourcesError) Error() string { return fmt.Sprintf(`task: Can't watch task "%s" because it has no specified sources`, err.taskName) } + +type dynamicVarError struct { + cause error + cmd string +} + +func (err *dynamicVarError) Error() string { + return fmt.Sprintf(`task: Command "%s" in taskvars file failed: %s`, err.cmd, err.cause) +} diff --git a/variable_handling.go b/variable_handling.go index 493390b1..cb53b0c0 100644 --- a/variable_handling.go +++ b/variable_handling.go @@ -41,7 +41,7 @@ func (e *Executor) handleDynamicVariableContent(value string) (string, error) { Stderr: e.Stderr, } if err := execext.RunCommand(opts); err != nil { - return "", err + return "", &dynamicVarError{cause: err, cmd: opts.Command} } result := buff.String()