errors

package
v0.20251216.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MPL-2.0 Imports: 5 Imported by: 199

Documentation

Overview

Package errors provide a special error type for use in Boulder. This error type carries additional type information with it, and has two special powers:

1. It is recognized by our gRPC code, and the type metadata and detail string will cross gRPC boundaries intact.

2. It is recognized by our frontend API "rendering" code, and will be automatically converted to the corresponding urn:ietf:params:acme:error:... ACME Problem Document.

This means that a deeply-nested service (such as the SA) that wants to ensure that the ACME client sees a particular problem document (such as NotFound) can return a BoulderError and be sure that it will be propagated all the way to the client.

Note, however, that any additional context wrapped *around* the BoulderError (such as by fmt.Errorf("oops: %w")) will be lost when the error is converted into a problem document. Similarly, any type information wrapped *by* a BoulderError (such as a sql.ErrNoRows) is lost at the gRPC serialization boundary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountDoesNotExistError

func AccountDoesNotExistError(msg string, args ...any) error

func AlreadyReplacedError

func AlreadyReplacedError(msg string, args ...any) error

func AlreadyRevokedError

func AlreadyRevokedError(msg string, args ...any) error

func BadCSRError

func BadCSRError(msg string, args ...any) error

func BadNonceError

func BadNonceError(msg string, args ...any) error

func BadPublicKeyError

func BadPublicKeyError(msg string, args ...any) error

func BadRevocationReasonError

func BadRevocationReasonError(reason int64) error

func BadSignatureAlgorithmError

func BadSignatureAlgorithmError(msg string, args ...any) error

func CAAError

func CAAError(msg string, args ...any) error

func CertificatesPerDomainError

func CertificatesPerDomainError(retryAfter time.Duration, msg string, args ...any) error

func CertificatesPerFQDNSetError

func CertificatesPerFQDNSetError(retryAfter time.Duration, msg string, args ...any) error

func ConnectionFailureError

func ConnectionFailureError(msg string, args ...any) error

func DNSError

func DNSError(msg string, args ...any) error

func DuplicateError

func DuplicateError(msg string, args ...any) error

func FailedAuthorizationsPerDomainPerAccountError

func FailedAuthorizationsPerDomainPerAccountError(retryAfter time.Duration, msg string, args ...any) error

func InternalServerError

func InternalServerError(msg string, args ...any) error

func InvalidEmailError

func InvalidEmailError(msg string, args ...any) error

func InvalidProfileError

func InvalidProfileError(msg string, args ...any) error

func LimitOverrideRequestsPerIPAddressError added in v0.20250902.0

func LimitOverrideRequestsPerIPAddressError(retryAfter time.Duration, msg string, args ...any) error

func MalformedError

func MalformedError(msg string, args ...any) error

func MissingSCTsError

func MissingSCTsError(msg string, args ...any) error

func New

func New(errType ErrorType, msg string) error

New is a convenience function for creating a new BoulderError.

func NewOrdersPerAccountError

func NewOrdersPerAccountError(retryAfter time.Duration, msg string, args ...any) error

func NotFoundError

func NotFoundError(msg string, args ...any) error

func OrderNotReadyError

func OrderNotReadyError(msg string, args ...any) error

func RateLimitError

func RateLimitError(retryAfter time.Duration, msg string, args ...any) error

func RegistrationsPerIPAddressError

func RegistrationsPerIPAddressError(retryAfter time.Duration, msg string, args ...any) error

func RegistrationsPerIPv6RangeError

func RegistrationsPerIPv6RangeError(retryAfter time.Duration, msg string, args ...any) error

func RejectedIdentifierError

func RejectedIdentifierError(msg string, args ...any) error

func UnauthorizedError

func UnauthorizedError(msg string, args ...any) error

func UnknownSerialError

func UnknownSerialError() error

func UnsupportedContactError

func UnsupportedContactError(msg string, args ...any) error

Types

type BoulderError

type BoulderError struct {
	Type      ErrorType
	Detail    string
	SubErrors []SubBoulderError

	// RetryAfter the duration a client should wait before retrying the request
	// which resulted in this error.
	RetryAfter time.Duration
}

BoulderError represents internal Boulder errors

func (*BoulderError) Error

func (be *BoulderError) Error() string

Error implements the error interface, returning a string representation of this error.

func (*BoulderError) GRPCStatus

func (be *BoulderError) GRPCStatus() *status.Status

GRPCStatus implements the interface implicitly defined by gRPC's status.FromError, which uses this function to detect if the error produced by the gRPC server implementation code is a gRPC status.Status. Implementing this means that BoulderErrors serialized in gRPC response metadata can be accompanied by a gRPC status other than "UNKNOWN".

func (*BoulderError) Unwrap

func (be *BoulderError) Unwrap() error

Unwrap implements the optional error-unwrapping interface. It returns the underlying type, all of when themselves implement the error interface, so that `if errors.Is(someError, berrors.Malformed)` works.

func (*BoulderError) WithSubErrors

func (be *BoulderError) WithSubErrors(subErrs []SubBoulderError) *BoulderError

WithSubErrors returns a new BoulderError instance created by adding the provided subErrs to the existing BoulderError.

type ErrorType

type ErrorType int

ErrorType provides a coarse category for BoulderErrors. Objects of type ErrorType should never be directly returned by other functions; instead use the methods below to create an appropriate BoulderError wrapping one of these types.

const (
	// InternalServer is deprecated. Instead, pass a plain Go error. That will get
	// turned into a probs.InternalServerError by the WFE.
	InternalServer ErrorType = iota

	Malformed
	Unauthorized
	NotFound
	RateLimit
	RejectedIdentifier
	InvalidEmail
	ConnectionFailure

	CAA
	MissingSCTs
	Duplicate
	OrderNotReady
	DNS
	BadPublicKey
	BadCSR
	AlreadyRevoked
	BadRevocationReason
	UnsupportedContact
	// The requested serial number does not exist in the `serials` table.
	UnknownSerial
	Conflict
	// Defined in https://datatracker.ietf.org/doc/draft-aaron-acme-profiles/00/
	InvalidProfile
	// The certificate being indicated for replacement already has a replacement
	// order.
	AlreadyReplaced
	BadSignatureAlgorithm
	AccountDoesNotExist
	BadNonce
)

These numeric constants are used when sending berrors through gRPC.

func (ErrorType) Error

func (ErrorType) Error() string

type SubBoulderError

type SubBoulderError struct {
	*BoulderError
	Identifier identifier.ACMEIdentifier
}

SubBoulderError represents sub-errors specific to an identifier that are related to a top-level internal Boulder error.

Jump to

Keyboard shortcuts

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