apperr

package
v4.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeOK    int = 0
	ExitCodeError int = iota
)

Exit codes are int values for the exit code that shell interpreter can interpret

Variables

This section is empty.

Functions

func HandleExit

func HandleExit(err error) int

HandleExit returns int value that shell interpreter can interpret as the exit code If err has error message, it will be displayed to stderr This function is heavily inspired by urfave/cli.HandleExitCoder

Types

type ErrorFormatter

type ErrorFormatter interface {
	Format(s fmt.State, verb rune)
}

ErrorFormatter is the interface for format

type ExitCoder

type ExitCoder interface {
	error
	ExitCode() int
}

ExitCoder is the wrapper interface for urfave/cli

type ExitError

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

ExitError is the wrapper struct for urfave/cli

func NewExitError

func NewExitError(exitCode int, err error) *ExitError

NewExitError makes a new ExitError

func (*ExitError) Error

func (ee *ExitError) Error() string

Error returns the string message, fulfilling the interface required by `error`

func (*ExitError) ExitCode

func (ee *ExitError) ExitCode() int

ExitCode returns the exit code, fulfilling the interface required by `ExitCoder`

Jump to

Keyboard shortcuts

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