errors

package
v0.0.0-...-24daea3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success Status = 0 // NoError indicates there is no errors.

	GeneralError = 1 // It is for undefined error, but should be avoid to use if possible.

	// Exit code 30 - 59 will be reserved for user related errors
	MarshalError   = 30 // Failed to marshal data.
	UnmarshalError      // Failed to unmarshal data.

	InvalidArgument = 35 // Invalid argument.
	MissingArgument      // Missing argument.

	// Exit code 60 - 100 will be reserved for server related errors.
	IOCreateError  = 60 // Failed to create file or directory.
	IOAccessError       // Failed to access file or directory.
	IOCaptureError      // Failed to capture stdin/stdout/stderr of command

	ConnectionError = 70 // Failed to connect.

	ServerStartingError = 80 // Failed to start a GRPC server.

	MessageSendingError = 85 // Failed to send message.

	CommandStartingError = 90 // Failed to start a command.
	CommandExitError          // Command exit with error.
)

Following constants are possible value for the status of StatusError.

Variables

This section is empty.

Functions

func WriteError

func WriteError(w io.Writer, err error) int

WriteError writes a newline-terminated fatal error to w and returns the status code to use when exiting. If err is not a *StatusError, status code 1 is returned.

Types

type Status

type Status int

Status defines different exit code for testexecservice.

type StatusError

type StatusError struct {
	// contains filtered or unexported fields
}

StatusError stores both the exit status and the actual error.

func NewStatusError

func NewStatusError(status Status, err error) *StatusError

NewStatusError creates a StatusError with the passed status code and error.

func (*StatusError) Error

func (e *StatusError) Error() string

Unwrap return the actual error

func (*StatusError) Status

func (e *StatusError) Status() Status

Status returns the status code.

func (*StatusError) Unwrap

func (e *StatusError) Unwrap() error

Unwrap return the actual error

Jump to

Keyboard shortcuts

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