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

feat: better taskfile cycle error handling

This commit is contained in:
Pete Davison
2023-09-06 00:00:36 +00:00
parent 0a027df50d
commit 220bf74a9e
3 changed files with 25 additions and 0 deletions

View File

@@ -191,3 +191,21 @@ func (err *TaskfileDuplicateIncludeError) Error() string {
func (err *TaskfileDuplicateIncludeError) Code() int {
return CodeTaskfileDuplicateInclude
}
// TaskfileCycleError is returned when we detect that a Taskfile includes a
// set of Taskfiles that include each other in a cycle.
type TaskfileCycleError struct {
Source string
Destination string
}
func (err TaskfileCycleError) Error() string {
return fmt.Sprintf("task: include cycle detected between %s <--> %s",
err.Source,
err.Destination,
)
}
func (err TaskfileCycleError) Code() int {
return CodeTaskfileCycle
}