safeerror

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package safeerror redacts extension failures without adding classifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributeSource

func AttributeSource(err error) error

AttributeSource identifies the construction owner shared by transparent views. Distinct failures may carry equal attribute keys and values.

func Attributes

func Attributes(err error) []fault.Attribute

func Diagnostic

func Diagnostic(message string, cause error) error

Diagnostic retains a cause for errors.Is/As that must not supply an HTTP classification. Use only where retaining a previously discarded cause.

func FaultDiagnostic

func FaultDiagnostic(err error) (fault.Note, []fault.Frame, bool)

FaultDiagnostic reads only an immutable construction snapshot. The cause may expose a mutable public fault for identity; it is not a diagnostic authority.

func HasCode

func HasCode(err error, code fault.Code) bool

HasCode checks a construction snapshot without inspecting application methods.

func IsDiagnostic

func IsDiagnostic(err error) bool

IsDiagnostic identifies the framework-owned boundary without calling error methods.

func IsPanic

func IsPanic(err error) bool

IsPanic recognizes owner-issued panic classification without error traversal.

func Join

func Join(fallback string, failures ...error) error

Join retains immutable diagnostics across cleanup aggregation. Unmarked siblings contribute only fallback text; every original cause remains in order. A single failure keeps its exact identity, including unmarked failures.

func New

func New(message string) error

New creates an unclassified source diagnostic; it never adds a fault code.

func NewFault

func NewFault(code fault.Code, message string) error

NewFault snapshots a diagnostic at its framework construction site. Unlike recognizing an arbitrary *fault.Error later, this cannot trust application messages or an application mutation of an exposed fault.

func Owned

func Owned(message string, cause error) error

Owned marks an immutable diagnostic produced by a framework owner. Callback containment can retain this text without inspecting or formatting the cause. Never derive message from an application error or an already-exposed fault.

func OwnedMessage

func OwnedMessage(err error) (string, bool)

OwnedMessage recognizes only concrete framework markers and capsules carrying their captured text. It never walks causes or invokes application methods.

func Panic

func Panic(message string, frames []fault.Frame) error

Panic snapshots source locations at the recovery owner, never from an application-returned fault or recovered payload.

func Prefix

func Prefix(operation string, cause error) error

Prefix adds framework operation context without formatting an application cause.

func Retain

func Retain(original, result error) error

Retain reattaches an already captured diagnostic after an owner adds outcome or cleanup causes. It neither inspects nor replaces that returned cause graph.

func Reveal

func Reveal(message string, foreign error) error

Reveal exposes sealed causes only after leaving the foreign library. The projection is lazy: constructing it calls no application methods. Subsequent framework inspection must use bounded errorgraph traversal inside containment.

func Seal

func Seal(message string, cause error) error

Seal keeps application causes opaque to foreign-library formatting and error inspection. Reveal restores them after the foreign operation has returned.

func SealMatching

func SealMatching(message string, cause, match error) error

SealMatching preserves one already-established framework control sentinel without allowing the foreign library to inspect the original cause.

func Sentinel

func Sentinel(code fault.Code, message string) *fault.Error

Sentinel constructs a framework sentinel with immutable diagnostic metadata. Use only for package-level constants, never for per-operation failures.

func UnwrapOwned

func UnwrapOwned(err error) error

UnwrapOwned removes only a source-issued immutable marker. It does not walk arbitrary causes or call application methods. Typed owners can use it where they previously checked a direct concrete result from another framework owner.

func WithAttributes

func WithAttributes(err, source error, attributes []fault.Attribute) error

WithAttributes captures attributes at their trusted construction owner. Values must be framework vocabulary, never application text or adapter metadata.

func Wrap

func Wrap(message string, cause error) error

Wrap retains cause for inspection without invoking its formatting methods. A nil cause stays nil; message must be framework-owned diagnostic text.

func WrapFailure

func WrapFailure(code fault.Code, message string, cause error) error

WrapFailure adds an operation classification and a fallback diagnostic while retaining a more specific diagnostic already captured by a framework owner.

func WrapFault

func WrapFault(code fault.Code, message string, cause error) error

WrapFault retains the cause without formatting it. Only framework-owned diagnostic text belongs in message.

Types

type DiagnosticID

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

DiagnosticID identifies one immutable construction snapshot. Transparent wrappers share it; distinct constructions keep distinct identities.

func FaultDiagnosticID

func FaultDiagnosticID(err error) DiagnosticID

Jump to

Keyboard shortcuts

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