Documentation
¶
Overview ¶
Package errorsx creates errors that record the call stack where they start.
Go errors carry no stack, so sentry-go gives an event the stack of the CaptureException call. Every failure reported from one place then shares one stack, and Sentry groups unrelated causes into one issue. An error from this package exposes its origin stack through StackTrace() []uintptr, which sentry-go reads, so Sentry groups the event by where the failure started.
Use New or Errorf where an error starts, and WithStack where an error from an external library enters the backend. Keep package-level sentinel errors as errors.New: a stack recorded at program start has no value.
github.com/pkg/errors is not used: it is archived, its Errorf does not support %w, and its Wrap records a new stack on each wrap.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errorf ¶
Errorf formats like fmt.Errorf, %w included. It records the stack of the caller, unless a wrapped error already has a stack: the origin stack is the one that tells failures apart.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package errorsxtest helps tests check the origin stack that Sentry records for an error.
|
Package errorsxtest helps tests check the origin stack that Sentry records for an error. |