errorcode

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 1 Imported by: 3

README

go-error-code CI

An opinionated module for bubbling up and consuming exit codes alongside errors. Useful for packages that are used by CLIs to return helpful codes to the caller without having to parse error strings.

install

go get github.com/frantjc/go-error-code

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

Types

type Error

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

func New

func New(err error, opts ...ErrorOpt) *Error

func (*Error) ExitCode

func (e *Error) ExitCode() int

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorOpt

type ErrorOpt func(*Error)

func WithExitCode

func WithExitCode(exitCode int) ErrorOpt

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

Jump to

Keyboard shortcuts

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