exitcode

package module
Version: v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: MIT Imports: 3 Imported by: 27

README

exitcode GoDoc Go Report Card

Go package to convert errors to exit codes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit(err error)

Exit is a convenience function that calls os.Exit with the exit code associated with err.

func Get

func Get(err error) int

Get gets the exit code associated with an error. Cases:

nil or flag.ErrHelp => 0
errors implementing Coder => value returned by ExitCode
all other errors => 1

func Set

func Set(err error, code int) error

Set wraps an error in a Coder, setting its error code.

Types

type Coder

type Coder interface {
	error
	ExitCode() int
}

Coder is an interface to control what value Get returns.

Source Files

Jump to

Keyboard shortcuts

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