mark

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 1 Imported by: 1 module, 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 mark provides a mechanism for tagging errors with a well-known error value.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound        = errors.New("not found")
	ErrAlreadyExists   = errors.New("already exists")
	ErrBadRequest      = errors.New("bad request")
	ErrUnauthorized    = errors.New("unauthorized")
	ErrCancelled       = errors.New("request cancelled")
	ErrUnavailable     = errors.New("unavailable")
	ErrTimedout        = errors.New("request timed out")
	ErrTooLarge        = errors.New("request is too large")
	ErrTooManyRequests = errors.New("too many requests")
	ErrForbidden       = errors.New("forbidden")
)

This list of errors is not exhaustive, but is a good starting point for most applications. Feel free to add more as needed, but don't go overboard. Remember, the specific types of errors are only important so far as someone calling your code might want to write logic to handle each type of error differently.

Do not add application-specific errors to this list. Instead, just define your own package with your own application-specific errors, and use this package to mark errors with them. The errors in this package are not special, they're just plain old errors.

Not all errors need to be marked. An error that is not marked should be treated as an unexpected error that cannot be handled by calling code. This is often the case for network errors or logic errors.

Functions

func With

func With(err, markErr error) error

With wraps err with another error that will return true from errors.Is and errors.As for both err and markErr, and anything either may wrap.

Types

This section is empty.

Jump to

Keyboard shortcuts

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