Documentation
¶
Overview ¶
Package fault provides transport-independent, classifiable framework errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
Attribute is a framework-owned, redaction-safe classification such as a PostgreSQL SQLSTATE or transport error code.
type Code ¶
type Code string
Code classifies an error without requiring callers to inspect its message. Codes implement error so errors.Is(err, fault.Invalid) is supported.
const ( Invalid Code = "invalid" Duplicate Code = "duplicate" Missing Code = "missing" Cycle Code = "cycle" Closed Code = "closed" Conflict Code = "conflict" Internal Code = "internal" Panicked Code = "panicked" Timeout Code = "timeout" // Overloaded reports temporarily exhausted concurrency or queue capacity. // The operation was not started; the same request may be retried later. // Transports map it to "service unavailable" rather than an internal error. Overloaded Code = "overloaded" )
type Diagnostic ¶
type Diagnostic struct {
Types []string `json:"types,omitempty"`
Faults []Note `json:"faults,omitempty"`
Attributes []Attribute `json:"attributes,omitempty"`
Frames []Frame `json:"frames,omitempty"`
// Truncated reports that bounds or a failing error method ended inspection.
Truncated bool `json:"truncated,omitempty"`
}
Diagnostic is a bounded, redacted failure summary that is safe to log and to export to error reporters. It contains dynamic Go type names, framework fault notes, framework attributes and contained-panic frames. It never contains arbitrary Error() text, payloads, credentials or recovered panic values.
func (Diagnostic) Clone ¶
func (d Diagnostic) Clone() Diagnostic
Clone returns an owned copy whose slices do not alias d.
func (Diagnostic) IsZero ¶
func (d Diagnostic) IsZero() bool
IsZero reports whether no failure information was captured.
func (Diagnostic) LogValue ¶
func (d Diagnostic) LogValue() slog.Value
LogValue renders the diagnostic as a structured slog group.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error retains an internal cause while exposing only its explicit safe message through formatting. Causes remain available through errors.Is/errors.As.
func Panic ¶
Panic constructs a Panicked fault retaining where the contained panic began. Frames carry source locations only, never argument values or the panic value.