1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Improve YAML parse error reporting

Fixes #467
This commit is contained in:
Andrey Nering
2021-04-17 17:12:39 -03:00
parent 43a1f1314e
commit 2d66a2f0f3
5 changed files with 43 additions and 70 deletions

View File

@@ -6,11 +6,6 @@ import (
"gopkg.in/yaml.v3"
)
var (
// ErrCantUnmarshalIncludedTaskfile is returned for invalid var YAML.
ErrCantUnmarshalIncludedTaskfile = errors.New("task: can't unmarshal included value")
)
// IncludedTaskfile represents information about included tasksfile
type IncludedTaskfile struct {
Taskfile string
@@ -98,12 +93,11 @@ func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) err
Taskfile string
Dir string
}
if err := unmarshal(&includedTaskfile); err == nil {
it.Dir = includedTaskfile.Dir
it.Taskfile = includedTaskfile.Taskfile
it.AdvancedImport = true
return nil
if err := unmarshal(&includedTaskfile); err != nil {
return err
}
return ErrCantUnmarshalIncludedTaskfile
it.Dir = includedTaskfile.Dir
it.Taskfile = includedTaskfile.Taskfile
it.AdvancedImport = true
return nil
}