mirror of
https://github.com/go-task/task.git
synced 2026-06-23 12:45:52 +00:00
feat: better error handling for duplicate edges and fixed tests
This commit is contained in:
@@ -19,6 +19,7 @@ const (
|
||||
CodeTaskfileCacheNotFound
|
||||
CodeTaskfileVersionCheckError
|
||||
CodeTaskfileNetworkTimeout
|
||||
CodeTaskfileDuplicateInclude
|
||||
)
|
||||
|
||||
// Task related exit codes
|
||||
|
||||
@@ -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