errors

package
v0.0.0-...-94d1468 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MPL-2.0 Imports: 5 Imported by: 40

Documentation

Overview

Package errors provides internal-facing error types for use in Boulder. Many of these are transformed directly into Problem Details documents by the WFE. Some, like NotFound, may be handled internally. We avoid using Problem Details documents as part of our internal error system to avoid layering confusions.

These errors are specifically for use in errors that cross RPC boundaries. An error type that does not need to be passed through an RPC can use a plain Go type locally. Our gRPC code is aware of these error types and will serialize and deserialize them automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlreadyRevokedError

func AlreadyRevokedError(msg string, args ...interface{}) error

func BadCSRError

func BadCSRError(msg string, args ...interface{}) error

func BadPublicKeyError

func BadPublicKeyError(msg string, args ...interface{}) error

func BadRevocationReasonError

func BadRevocationReasonError(reason int64) error

func CAAError

func CAAError(msg string, args ...interface{}) error

func ConflictError

func ConflictError(msg string, args ...interface{}) error

func ConnectionFailureError

func ConnectionFailureError(msg string, args ...interface{}) error

func DNSError

func DNSError(msg string, args ...interface{}) error

func DuplicateCertificateError

func DuplicateCertificateError(retryAfter time.Duration, msg string, args ...interface{}) error

func DuplicateError

func DuplicateError(msg string, args ...interface{}) error

func FailedValidationError

func FailedValidationError(retryAfter time.Duration, msg string, args ...interface{}) error

func InternalServerError

func InternalServerError(msg string, args ...interface{}) error

func InvalidEmailError

func InvalidEmailError(msg string, args ...interface{}) error

func MalformedError

func MalformedError(msg string, args ...interface{}) error

func MissingSCTsError

func MissingSCTsError(msg string, args ...interface{}) error

func New

func New(errType ErrorType, msg string, args ...interface{}) error

New is a convenience function for creating a new BoulderError

func NotFoundError

func NotFoundError(msg string, args ...interface{}) error

func OrderNotReadyError

func OrderNotReadyError(msg string, args ...interface{}) error

func RateLimitError

func RateLimitError(retryAfter time.Duration, msg string, args ...interface{}) error

func RegistrationsPerIPError

func RegistrationsPerIPError(retryAfter time.Duration, msg string, args ...interface{}) error

func RejectedIdentifierError

func RejectedIdentifierError(msg string, args ...interface{}) error

func UnauthorizedError

func UnauthorizedError(msg string, args ...interface{}) error

func UnknownSerialError

func UnknownSerialError() error

func UnsupportedContactError

func UnsupportedContactError(msg string, args ...interface{}) 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

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

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 requesteed serial number does not exist in the `serials` table.
	UnknownSerial
	// The certificate being indicated for replacement already has a replacement
	// order.
	Conflict
)

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