1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

feat: better error handling for duplicate edges and fixed tests

This commit is contained in:
Pete Davison
2023-09-05 23:55:56 +00:00
parent a50580b5a1
commit 0a027df50d
9 changed files with 52 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ package errors
import (
"fmt"
"net/http"
"strings"
"time"
"github.com/Masterminds/semver/v3"
@@ -174,3 +175,19 @@ func (err *TaskfileNetworkTimeoutError) Error() string {
func (err *TaskfileNetworkTimeoutError) Code() int {
return CodeTaskfileNetworkTimeout
}
type TaskfileDuplicateIncludeError struct {
URI string
IncludedURI string
Namespaces []string
}
func (err *TaskfileDuplicateIncludeError) Error() string {
return fmt.Sprintf(
`task: Taskfile %q attempted to include %q multiple times with namespaces: %s`, err.URI, err.IncludedURI, strings.Join(err.Namespaces, ", "),
)
}
func (err *TaskfileDuplicateIncludeError) Code() int {
return CodeTaskfileDuplicateInclude
}