apperrors

package
v0.3.103-beta Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 4 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 apperrors defines the cross-cutting sentinel errors; named so callers can also import "errors".

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = std.New("not found")
	ErrConflict     = std.New("conflict")
	ErrUnauthorized = std.New("unauthorized")
	ErrForbidden    = std.New("forbidden")
	ErrInvalid      = std.New("invalid")
	ErrRetryable    = std.New("retryable")
	ErrFatal        = std.New("fatal")
	ErrRateLimited  = std.New("rate limited")
)

Functions

func Fatal

func Fatal(err error) error

Fatal wraps err so errors.Is(err, ErrFatal) holds. Event handlers return it for permanent failures the bus middleware should dead-letter immediately.

func Retryable

func Retryable(err error) error

Retryable wraps err so errors.Is(err, ErrRetryable) holds. Event handlers return it for transient failures the bus middleware should retry.

func WithCode

func WithCode(code string, err error) error

WithCode wraps err, which still matches its sentinel, with a machine code such as "invalid_code".

Types

type Coded

type Coded struct {
	Code string
	Err  error
}

Coded is an error carrying a stable machine code adapters report instead of the sentinel's generic one.

func (*Coded) Error

func (e *Coded) Error() string

func (*Coded) Unwrap

func (e *Coded) Unwrap() error

type InUseError

type InUseError struct {
	// Thing is what was asked to go, as it reads in a sentence, such as `tunnel "edge"`.
	Thing string
	// Users are what depend on it, each as it reads in a list, such as "app.example.com".
	Users []string
	// Fix says what to do first, such as "edit or remove them first".
	Fix string
}

InUseError refuses removing a thing while others still depend on it and names them; it matches ErrConflict, so every adapter reports it as a conflict with this one message.

func (*InUseError) Error

func (e *InUseError) Error() string

func (*InUseError) Unwrap

func (e *InUseError) Unwrap() error

type RetryAfterError

type RetryAfterError struct {
	Wait time.Duration
	Err  error
}

RetryAfterError is a Retryable failure that also says how long to wait first, such as a host's rate-limit reset.

func (*RetryAfterError) Error

func (e *RetryAfterError) Error() string

func (*RetryAfterError) Unwrap

func (e *RetryAfterError) Unwrap() []error

Jump to

Keyboard shortcuts

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