errors

package
v3.37.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CodeOk      int = iota // Used when the program exits without errors
	CodeUnknown            // Used when no other exit code is appropriate
)

General exit codes

View Source
const (
	CodeTaskfileNotFound int = iota + 100
	CodeTaskfileAlreadyExists
	CodeTaskfileInvalid
	CodeTaskfileFetchFailed
	CodeTaskfileNotTrusted
	CodeTaskfileNotSecure
	CodeTaskfileCacheNotFound
	CodeTaskfileVersionCheckError
	CodeTaskfileNetworkTimeout

	CodeTaskfileCycle
)

Taskfile related exit codes

View Source
const (
	CodeTaskNotFound int = iota + 200
	CodeTaskRunError
	CodeTaskInternal
	CodeTaskNameConflict
	CodeTaskCalledTooManyTimes
	CodeTaskCancelled
	CodeTaskMissingRequiredVars
)

Task related exit codes

Variables

This section is empty.

Functions

func As added in v3.30.0

func As(err error, target any) bool

As wraps the standard errors.As function so that we don't need to alias that package.

func Is added in v3.30.0

func Is(err, target error) bool

Is wraps the standard errors.Is function so that we don't need to alias that package.

func New

func New(text string) error

New returns an error that formats as the given text. Each call to New returns a distinct error value even if the text is identical. This wraps the standard errors.New function so that we don't need to alias that package.

Types

type TaskCalledTooManyTimesError

type TaskCalledTooManyTimesError struct {
	TaskName        string
	MaximumTaskCall int
}

TaskCalledTooManyTimesError is returned when the maximum task call limit is exceeded. This is to prevent infinite loops and cyclic dependencies.

func (*TaskCalledTooManyTimesError) Code

func (err *TaskCalledTooManyTimesError) Code() int

func (*TaskCalledTooManyTimesError) Error

func (err *TaskCalledTooManyTimesError) Error() string

type TaskCancelledByUserError added in v3.26.0

type TaskCancelledByUserError struct {
	TaskName string
}

TaskCancelledByUserError is returned when the user does not accept an optional prompt to continue.

func (*TaskCancelledByUserError) Code added in v3.26.0

func (err *TaskCancelledByUserError) Code() int

func (*TaskCancelledByUserError) Error added in v3.26.0

func (err *TaskCancelledByUserError) Error() string

type TaskCancelledNoTerminalError added in v3.26.0

type TaskCancelledNoTerminalError struct {
	TaskName string
}

TaskCancelledNoTerminalError is returned when trying to run a task with a prompt in a non-terminal environment.

func (*TaskCancelledNoTerminalError) Code added in v3.26.0

func (err *TaskCancelledNoTerminalError) Code() int

func (*TaskCancelledNoTerminalError) Error added in v3.26.0

func (err *TaskCancelledNoTerminalError) Error() string

type TaskError

type TaskError interface {
	error
	Code() int
}

TaskError extends the standard error interface with a Code method. This code will be used as the exit code of the program which allows the user to distinguish between different types of errors.

type TaskInternalError

type TaskInternalError struct {
	TaskName string
}

TaskInternalError when the user attempts to invoke a task that is internal.

func (*TaskInternalError) Code

func (err *TaskInternalError) Code() int

func (*TaskInternalError) Error

func (err *TaskInternalError) Error() string

type TaskMissingRequiredVars added in v3.27.0

type TaskMissingRequiredVars struct {
	TaskName    string
	MissingVars []string
}

TaskMissingRequiredVars is returned when a task is missing required variables.

func (*TaskMissingRequiredVars) Code added in v3.27.0

func (err *TaskMissingRequiredVars) Code() int

func (*TaskMissingRequiredVars) Error added in v3.27.0

func (err *TaskMissingRequiredVars) Error() string

type TaskNameConflictError

type TaskNameConflictError struct {
	Call      string
	TaskNames []string
}

TaskNameConflictError is returned when multiple tasks with a matching name or alias are found.

func (*TaskNameConflictError) Code

func (err *TaskNameConflictError) Code() int

func (*TaskNameConflictError) Error

func (err *TaskNameConflictError) Error() string

type TaskNotFoundError

type TaskNotFoundError struct {
	TaskName   string
	DidYouMean string
}

TaskNotFoundError is returned when the specified task is not found in the Taskfile.

func (*TaskNotFoundError) Code

func (err *TaskNotFoundError) Code() int

func (*TaskNotFoundError) Error

func (err *TaskNotFoundError) Error() string

type TaskRunError

type TaskRunError struct {
	TaskName string
	Err      error
}

TaskRunError is returned when a command in a task returns a non-zero exit code.

func (*TaskRunError) Code

func (err *TaskRunError) Code() int

func (*TaskRunError) Error

func (err *TaskRunError) Error() string

func (*TaskRunError) TaskExitCode

func (err *TaskRunError) TaskExitCode() int

type TaskfileAlreadyExistsError

type TaskfileAlreadyExistsError struct{}

TaskfileAlreadyExistsError is returned on creating a Taskfile if one already exists.

func (TaskfileAlreadyExistsError) Code

func (err TaskfileAlreadyExistsError) Code() int

func (TaskfileAlreadyExistsError) Error

func (err TaskfileAlreadyExistsError) Error() string

type TaskfileCacheNotFoundError added in v3.34.0

type TaskfileCacheNotFoundError struct {
	URI string
}

TaskfileCacheNotFoundError is returned when the user attempts to use an offline (cached) Taskfile but the files does not exist in the cache.

func (*TaskfileCacheNotFoundError) Code added in v3.34.0

func (err *TaskfileCacheNotFoundError) Code() int

func (*TaskfileCacheNotFoundError) Error added in v3.34.0

func (err *TaskfileCacheNotFoundError) Error() string

type TaskfileCycleError added in v3.37.0

type TaskfileCycleError struct {
	Source      string
	Destination string
}

TaskfileCycleError is returned when we detect that a Taskfile includes a set of Taskfiles that include each other in a cycle.

func (TaskfileCycleError) Code added in v3.37.0

func (err TaskfileCycleError) Code() int

func (TaskfileCycleError) Error added in v3.37.0

func (err TaskfileCycleError) Error() string

type TaskfileFetchFailedError added in v3.30.0

type TaskfileFetchFailedError struct {
	URI            string
	HTTPStatusCode int
}

TaskfileFetchFailedError is returned when no appropriate Taskfile is found when searching the filesystem.

func (TaskfileFetchFailedError) Code added in v3.30.0

func (err TaskfileFetchFailedError) Code() int

func (TaskfileFetchFailedError) Error added in v3.30.0

func (err TaskfileFetchFailedError) Error() string

type TaskfileInvalidError

type TaskfileInvalidError struct {
	URI string
	Err error
}

TaskfileInvalidError is returned when the Taskfile contains syntax errors or cannot be parsed for some reason.

func (TaskfileInvalidError) Code

func (err TaskfileInvalidError) Code() int

func (TaskfileInvalidError) Error

func (err TaskfileInvalidError) Error() string

type TaskfileNetworkTimeoutError added in v3.34.0

type TaskfileNetworkTimeoutError struct {
	URI          string
	Timeout      time.Duration
	CheckedCache bool
}

TaskfileNetworkTimeoutError is returned when the user attempts to use a remote Taskfile but a network connection could not be established within the timeout.

func (*TaskfileNetworkTimeoutError) Code added in v3.34.0

func (err *TaskfileNetworkTimeoutError) Code() int

func (*TaskfileNetworkTimeoutError) Error added in v3.34.0

func (err *TaskfileNetworkTimeoutError) Error() string

type TaskfileNotFoundError

type TaskfileNotFoundError struct {
	URI  string
	Walk bool
}

TaskfileNotFoundError is returned when no appropriate Taskfile is found when searching the filesystem.

func (TaskfileNotFoundError) Code

func (err TaskfileNotFoundError) Code() int

func (TaskfileNotFoundError) Error

func (err TaskfileNotFoundError) Error() string

type TaskfileNotSecureError added in v3.30.0

type TaskfileNotSecureError struct {
	URI string
}

TaskfileNotSecureError is returned when the user attempts to download a remote Taskfile over an insecure connection.

func (*TaskfileNotSecureError) Code added in v3.30.0

func (err *TaskfileNotSecureError) Code() int

func (*TaskfileNotSecureError) Error added in v3.30.0

func (err *TaskfileNotSecureError) Error() string

type TaskfileNotTrustedError added in v3.30.0

type TaskfileNotTrustedError struct {
	URI string
}

TaskfileNotTrustedError is returned when the user does not accept the trust prompt when downloading a remote Taskfile.

func (*TaskfileNotTrustedError) Code added in v3.30.0

func (err *TaskfileNotTrustedError) Code() int

func (*TaskfileNotTrustedError) Error added in v3.30.0

func (err *TaskfileNotTrustedError) Error() string

type TaskfileVersionCheckError added in v3.34.0

type TaskfileVersionCheckError struct {
	URI           string
	SchemaVersion *semver.Version
	Message       string
}

TaskfileVersionCheckError is returned when the user attempts to run a Taskfile that does not contain a Taskfile schema version key or if they try to use a feature that is not supported by the schema version.

func (*TaskfileVersionCheckError) Code added in v3.34.0

func (err *TaskfileVersionCheckError) Code() int

func (*TaskfileVersionCheckError) Error added in v3.34.0

func (err *TaskfileVersionCheckError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL