wireerror

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wireerror is the error contract: the typed, wavefront-originated failures returned to a client as a proper HTTP status + standard headers + the `X-Wavefront-Error` code + a fixed `wavefront.v0.Error` protobuf body. Established in v0.1 and stable through v1.0 (iterated additively). The code/ status/header table here is authoritative against docs/protocol.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is a typed, wavefront-originated failure. It satisfies the error interface so it can flow through normal Go error handling.

func DecodeFailed

func DecodeFailed(msg string) *Error

DecodeFailed — the client body did not decode into the contract's request_message. 400.

func RequestBodyTooLarge

func RequestBodyTooLarge(msg string) *Error

RequestBodyTooLarge — the inbound body exceeded WAVEFRONT_MAX_BODY_BYTES. 413.

func TransformFailedRequest added in v0.2.0

func TransformFailedRequest(msg string) *Error

TransformFailedRequest — a request transform verb could not apply: the decoded request is well-formed but unprocessable under this contract's mapping. 422 (RFC 9110 §15.5.21).

func TransformFailedResponse added in v0.2.0

func TransformFailedResponse(msg string) *Error

TransformFailedResponse — a response transform verb could not apply: the live internal shape drifted from the bundle's response stanzas. Same fault class as upstream_error. 502.

func UnsupportedContractVersion

func UnsupportedContractVersion(msg string) *Error

UnsupportedContractVersion — the contract-version header is missing, unknown, or unsupported. 400.

func UpstreamError

func UpstreamError(msg string) *Error

UpstreamError — the upstream returned a non-2xx, was unreachable, or its reply could not be encoded. 502.

func UpstreamTimeout

func UpstreamTimeout(msg string) *Error

UpstreamTimeout — the upstream exceeded WAVEFRONT_REQUEST_TIMEOUT_MS. 504.

func (*Error) Code

func (e *Error) Code() string

func (*Error) Error

func (e *Error) Error() string

func (*Error) HTTPStatus

func (e *Error) HTTPStatus() int

func (*Error) Headers

func (e *Error) Headers() http.Header

Headers is the standard + extension header set for this failure. Content-Type is always the protobuf media type; Retry-After is set only where retrying is semantically meaningful. The X-Wavefront-Error / X-Wavefront-Contract-Version headers are written by the server (the latter needs request context the error itself does not carry).

func (*Error) Message

func (e *Error) Message() string

func (*Error) ProtoBody

func (e *Error) ProtoBody() []byte

ProtoBody is the marshaled wavefront.v0.Error response body.

Jump to

Keyboard shortcuts

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