sentinel error

A specific error value published in a package-level variable, such as io.EOF or os.ErrNotExist, that callers can test for with errors.Is.

In more detail

By convention the name starts with Err. Publishing one tells callers they may branch on it, for example use defaults when a config file is missing. Document which sentinel errors a function can return.

Example

var ErrBusy = errors.New("busy")

Related terms

Taught in

References