1
0
mirror of https://github.com/go-task/task.git synced 2025-11-27 22:38:20 +02:00

refactor: consistent naming for errors

This commit is contained in:
Pete Davison
2024-01-11 22:30:52 +00:00
committed by Andrey Nering
parent e2b85c6aa1
commit 26e79121f9
2 changed files with 11 additions and 11 deletions

View File

@@ -107,20 +107,20 @@ func (err *TaskfileNotSecureError) Code() int {
return CodeTaskfileNotSecure
}
// TaskfileCacheNotFound is returned when the user attempts to use an offline
// TaskfileCacheNotFoundError is returned when the user attempts to use an offline
// (cached) Taskfile but the files does not exist in the cache.
type TaskfileCacheNotFound struct {
type TaskfileCacheNotFoundError struct {
URI string
}
func (err *TaskfileCacheNotFound) Error() string {
func (err *TaskfileCacheNotFoundError) Error() string {
return fmt.Sprintf(
`task: Taskfile %q was not found in the cache. Remove the --offline flag to use a remote copy or download it using the --download flag`,
err.URI,
)
}
func (err *TaskfileCacheNotFound) Code() int {
func (err *TaskfileCacheNotFoundError) Code() int {
return CodeTaskfileCacheNotFound
}
@@ -152,15 +152,15 @@ func (err *TaskfileVersionCheckError) Code() int {
return CodeTaskfileVersionCheckError
}
// TaskfileNetworkTimeout is returned when the user attempts to use a remote
// TaskfileNetworkTimeoutError is returned when the user attempts to use a remote
// Taskfile but a network connection could not be established within the timeout.
type TaskfileNetworkTimeout struct {
type TaskfileNetworkTimeoutError struct {
URI string
Timeout time.Duration
CheckedCache bool
}
func (err *TaskfileNetworkTimeout) Error() string {
func (err *TaskfileNetworkTimeoutError) Error() string {
var cacheText string
if err.CheckedCache {
cacheText = " and no offline copy was found in the cache"
@@ -171,6 +171,6 @@ func (err *TaskfileNetworkTimeout) Error() string {
)
}
func (err *TaskfileNetworkTimeout) Code() int {
func (err *TaskfileNetworkTimeoutError) Code() int {
return CodeTaskfileNetworkTimeout
}