Documentation ¶
Index ¶
- Constants
- Variables
- func All(fns ...func() error) error
- func AllCtx(ctx context.Context, fns ...func(ctx context.Context) error) error
- func Code(kind, ns, axiom uint16) stacktrace.ErrorCode
- func HasAnyFlag(err error, flags ...uint16) bool
- func HasCode(err error, code stacktrace.ErrorCode) bool
- func HasFlag(err error, flag uint16) bool
- func InstallPanicObserver()
- func InvalidCast(expected, got any) error
- func IsNotFoundCode(bit uint16) bool
- func IsPersistentCode(bit uint16) bool
- func IsTransient(err error) bool
- func IsTransientCode(bit uint16) bool
- func Must(err error)
- func Mustf(err error, format string, args ...any)
- func NewGroup() []error
- func NotImplemented(reason string) error
- func Persistent(bit uint16) uint16
- func PersistentCode(ns, axiom uint16) stacktrace.ErrorCode
- func RegisterAxiom(flag uint16, name string)
- func RegisterDomain(flag uint16, name string)
- func ResourceNotFound(bit uint16) uint16
- func Transient(bit uint16) uint16
- func TransientCode(ns, axiom uint16) stacktrace.ErrorCode
- func ValidateContext(ctx context.Context) error
- type DiagnosticManifest
- type Group
- type Registry
Constants ¶
View Source
const ( //KTransient is an error kind that may happen outside the application invariants (network failure, service down) // transient errors must only be associated with retryable idempotent domain KTransient = 0x0000 //KPersistent is an error kind that is considered inside the application invariants (bad input, wrong initialisation order) // persistent errors are generally unrecoverable due to bad domain invariants, or programming errors KPersistent = 0x7000 //DResource is an error domain for resources (database model, configuration, etc...) DResource = 0x0100 //DService is an error domain for services (clients, database drivers, etc...) DService = 0x0200 //DTemporal is an error domain for everything `time` related (timeout, tickers, etc...) DTemporal = 0x0300 //DSize is an error domain for sizeable items (array, buffer, etc...) DSize = 0x0400 //DLogic is an error domain for logic (loops, control-flow, etc...) DLogic = 0x0500 //DIO is an error domain for IO (file, http-transport, etc...) DIO = 0x0600 //DUser is an error domain related to user interactions (form submission, user inputs, etc...) DUser = 0x0700 //DEncoding is an error domain related to serialization (JSON, text, etc...) DEncoding = 0x0800 //DDependency is an error domain related to dependencies, mostly used by the di system DDependency = 0x0900 //DSynchro is an error domain related to synchronisation semantics (context, mutex, etc...) DSynchro = 0x0a00 //DType is an error domain related to the type system (any, reflection, etc...) DType = 0x0b00 //DValue is an error domain related to values DValue = 0x0c00 //DTransport is an error domain related to transports (tcp, etc...) DTransport = 0x0d00 //ANotFound is an error axiom for missing or not found items ANotFound = 0x0010 //AMalformed is an error axiom for malformed or corrupted items AMalformed = 0x0020 //AInvariant is an error axiom for invariants (eg: nil check) AInvariant = 0x0030 //ATooBig is an error axiom mostly for sizeable items (mostly used in conjunction with `DSize`) ATooBig = 0x0040 //ATooSmall is an error axiom mostly for sizeable items (mostly used in conjunction with `DSize`) ATooSmall = 0x0050 //AUnexpected is an error axiom used to mark an interaction as unwanted AUnexpected = 0x0060 //AUnreachable is an error axiom used to define unreachable areas of code or logic AUnreachable = 0x0070 //AUnimplemented is an error axiom for missing domain AUnimplemented = 0x0080 //ANil is an error axiom for nil values ANil = 0x0090 //ATimeout is an error relating to time outs ATimeout = 0x00a0 )
Variables ¶
View Source
var ( //EInvalidContext signals that a context is no longer valid, but should have been at the time of invocation EInvalidContext = PersistentCode(DSynchro, AInvariant) //ENotImplemented signals that this part of logic was not implemented ENotImplemented = PersistentCode(DLogic, AUnimplemented) //EInvalidCast todo EInvalidCast = PersistentCode(DType, AInvariant) //EUnreachable todo EUnreachable = PersistentCode(DLogic, AUnreachable) // ENil todo ENil = PersistentCode(DType, ANil) )
Functions ¶
func AllCtx ¶
AllCtx executes a list of `func(context.Context) error` and stops if the `context.Context` is no longer valid, or at the first non-nil error encountered
func Code ¶
func Code(kind, ns, axiom uint16) stacktrace.ErrorCode
func HasAnyFlag ¶ added in v0.1.1
func InstallPanicObserver ¶
func InstallPanicObserver()
func InvalidCast ¶
func IsNotFoundCode ¶
func IsPersistentCode ¶
func IsTransient ¶
func IsTransientCode ¶
func NotImplemented ¶
func Persistent ¶
func PersistentCode ¶
func PersistentCode(ns, axiom uint16) stacktrace.ErrorCode
func RegisterAxiom ¶
func RegisterDomain ¶
func ResourceNotFound ¶
func TransientCode ¶
func TransientCode(ns, axiom uint16) stacktrace.ErrorCode
func ValidateContext ¶
Types ¶
type DiagnosticManifest ¶
type DiagnosticManifest struct { Transient bool Domain string Axiom string Error error // contains filtered or unexported fields }
func Diagnostic ¶
func Diagnostic(err error) DiagnosticManifest
func (DiagnosticManifest) String ¶
func (d DiagnosticManifest) String() string
type Registry ¶
func (*Registry) RegisterAxiom ¶
Click to show internal directories.
Click to hide internal directories.