mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
feat: better error handling for duplicate edges and fixed tests
This commit is contained in:
@@ -141,7 +141,19 @@ func (r *Reader) include(node Node) error {
|
||||
}
|
||||
|
||||
// Create an edge between the Taskfiles
|
||||
return r.graph.AddEdge(node.Location(), includeNode.Location())
|
||||
err = r.graph.AddEdge(node.Location(), includeNode.Location())
|
||||
if errors.Is(err, graph.ErrEdgeAlreadyExists) {
|
||||
edge, err := r.graph.Edge(node.Location(), includeNode.Location())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return &errors.TaskfileDuplicateIncludeError{
|
||||
URI: node.Location(),
|
||||
IncludedURI: includeNode.Location(),
|
||||
Namespaces: []string{namespace, edge.Properties.Data.(*ast.Include).Namespace},
|
||||
}
|
||||
}
|
||||
return err
|
||||
})
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user