mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
feat: better yaml parsing and error handling (#1619)
This commit is contained in:
@@ -265,6 +265,11 @@ func (r *Reader) readNode(node Node) (*ast.Taskfile, error) {
|
||||
|
||||
var tf ast.Taskfile
|
||||
if err := yaml.Unmarshal(b, &tf); err != nil {
|
||||
// Decode the taskfile and add the file info the any errors
|
||||
taskfileInvalidErr := &errors.TaskfileDecodeError{}
|
||||
if errors.As(err, &taskfileInvalidErr) {
|
||||
return nil, taskfileInvalidErr.WithFileInfo(node.Location(), b, 2)
|
||||
}
|
||||
return nil, &errors.TaskfileInvalidError{URI: filepathext.TryAbsToRel(node.Location()), Err: err}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user