Help us shape the future of Go! Take the 2026 Go Developer Survey

errcode

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package errcode is the one table of TSLink's stable error codes: for each code, the process exit code it produces, whether a daemon failure with it isolates one service, and what it means. output.ExitCode, the daemon's per-service isolation and the manifest's error_codes are all derived from this table, and a test scans the product source so an emitted code the table does not list fails the tests.

The Go constants that name the codes stay beside the code that raises them (registry.CodeX, config.CodeX); the table is keyed by the wire string, which never changes once released.

Index

Constants

View Source
const (
	ExitSuccess  = 0
	ExitError    = 1
	ExitUsage    = 2
	ExitAuth     = 3
	ExitConflict = 4
	ExitNotFound = 5
	ExitWarning  = 64
	ExitCritical = 65
)

Exit codes. internal/output re-exports them.

View Source
const (
	InternalError = "internal_error"
	UsageError    = "usage_error"
	AuthError     = "auth_error"
	Conflict      = "conflict"
	NotFound      = "not_found"
)

Generic codes name an exit class and nothing more: output.StableErrorCode gives them to an error that carries only an exit code.

Variables

This section is empty.

Functions

func ExitFor

func ExitFor(code string) int

ExitFor returns the exit code a failure with this stable code produces. A code the table does not list exits ExitError; the source scan test keeps that case out of the product.

func Generic

func Generic(exit int) string

Generic returns the generic code of an exit class.

func IsServiceScoped

func IsServiceScoped(code string) bool

IsServiceScoped reports whether a daemon failure with this code isolates the one service it belongs to instead of failing the sync.

Types

type Code

type Code struct {
	Code        string
	Exit        int
	Scope       Scope
	Description string
}

Code is one row of the table.

func All

func All() []Code

All returns every row, sorted by code.

func Lookup

func Lookup(code string) (Code, bool)

Lookup returns the table row for a stable code.

type Scope

type Scope int

Scope says what a failure with a code stops when the daemon meets it.

const (
	// Command codes fail the command that raised them. In the daemon they are
	// not a verdict about one service, so a sync that meets one fails.
	Command Scope = iota
	// Service codes describe one service's configuration or start. The daemon
	// isolates that service, records the failure with its next steps for
	// status and doctor, and keeps serving the others.
	Service
)

Jump to

Keyboard shortcuts

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