errno

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package errno provides a way to handle errors with exit codes.

Index

Constants

View Source
const (
	// ExitOK is the exit code for a successful operation.
	ExitOK uint8 = iota

	// ExitError is the exit code for a generic error.
	ExitError

	// ExitUsage is the exit code for an incorrect usage of a command.
	ExitUsage

	// ExitIO is the exit code for an I/O error.
	ExitIO

	// ExitNotFound is the exit code for a file not found error.
	ExitNotFound

	// ExitPermission is the exit code for an I/O permission denied error.
	ExitPermission

	// ExitAPIError is the exit code for errors related to API requests.
	ExitAPIError

	// ExitUnauthorized is the exit code for unauthorized requests to the OpenAI
	// API.
	ExitUnauthorized

	// ExitTimeout is the exit code for timeout errors.
	ExitTimeout

	// ExitInvalidInput is the exit code for invalid input errors.
	ExitInvalidInput
)

Exit codes for errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// Err is the underlying error that caused this error.
	Err error

	// No is the machine-readable exit code.
	No uint8
}

Error is an error with an exit code.

func New

func New(code uint8, err error) *Error

New creates a new Error with the given exit code and error.

func (*Error) Code

func (e *Error) Code() int

Code returns the exit code of the error as an integer.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface for Error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying error.

Jump to

Keyboard shortcuts

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