Documentation
¶
Overview ¶
Package apierr provides error classification and HTTP status mapping for Tumblebug API responses, inspired by pkg.go.dev/k8s.io/apimachinery/pkg/api/errors.
Use Wrap in the resource layer to attach a message to downstream errors, and Code in REST handlers to derive the HTTP status code.
IsNotFound and IsConflict classify errors in priority order: (1) Spider IID pattern — most reliable, set before any CSP call (Spider PR #1623). (2) Message patterns — CSP text Spider proxies as HTTP 500. (3) HTTP status — lowest priority; Spider's status is inconsistent (VPC always 500).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConflict ¶
IsConflict reports whether err represents a conflict / already-exists condition.
func IsNotFound ¶
IsNotFound reports whether err represents a not-found condition.
Types ¶
type StatusError ¶
type StatusError struct {
StatusCode int
Message string // Tumblebug-level message; empty until set by Wrap.
Cause error // raw Spider / Terrarium / network error.
}
StatusError is the error type used throughout the Tumblebug pipeline. HandleHttpResponse sets StatusCode and Cause; Wrap sets Message. Error() returns "message: cause", or whichever field is non-empty.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
func (*StatusError) Unwrap ¶
func (e *StatusError) Unwrap() error
Unwrap implements the errors unwrap interface.