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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user