clierr

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package clierr defines the error kinds commands return and the stable exit codes they map to. The codes follow gh and are a compatibility contract: 0 success, 1 failure (including usage errors), 2 cancelled, 4 auth required.

Index

Constants

This section is empty.

Variables

View Source
var ErrCancel = errors.New("cancelled")

ErrCancel signals that the user cancelled an interactive prompt.

View Source
var ErrSilent = errors.New("silent error")

ErrSilent fails the command with exit 1 after the command already printed its own diagnostics.

Functions

func AuthErrorWrap

func AuthErrorWrap(err error) error

AuthErrorWrap marks err as an authentication error.

func AuthErrorf

func AuthErrorf(format string, args ...any) error

AuthErrorf returns an authentication error.

func FlagErrorWrap

func FlagErrorWrap(err error) error

FlagErrorWrap marks err as a usage error.

func FlagErrorf

func FlagErrorf(format string, args ...any) error

FlagErrorf returns a usage error.

Types

type AuthError

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

AuthError means the command needs credentials it does not have or that were rejected.

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) Unwrap

func (e *AuthError) Unwrap() error

type ExitCode

type ExitCode int

ExitCode is a process exit status.

const (
	ExitOK           ExitCode = 0
	ExitError        ExitCode = 1
	ExitCancel       ExitCode = 2
	ExitAuthRequired ExitCode = 4
)

func Code

func Code(err error) ExitCode

Code maps an error returned by a command to its exit code.

type FlagError

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

FlagError is a usage error: bad flags, arguments or flag combinations. It exits 1 like any failure; it differs only in printing a --help hint.

func (*FlagError) Error

func (e *FlagError) Error() string

func (*FlagError) Unwrap

func (e *FlagError) Unwrap() error

type StatusCoder

type StatusCoder interface {
	error
	HTTPStatus() int
}

StatusCoder is implemented by API errors that carry an HTTP status.

Jump to

Keyboard shortcuts

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