Documentation ¶
Overview ¶
Package errutil combines primitives from the library, the Go errors package and github.com/pkg/errors. It aims to serve as drop-in replacement to gitub.com/pkg/errors and replace the legacy implementation of `pgerrors`.
Index ¶
- func AssertionFailedWithDepthf(depth int, format string, args ...interface{}) error
- func AssertionFailedf(format string, args ...interface{}) error
- func New(msg string) error
- func NewAssertionErrorWithWrappedErrDepthf(depth int, origErr error, format string, args ...interface{}) error
- func NewAssertionErrorWithWrappedErrf(origErr error, format string, args ...interface{}) error
- func NewWithDepth(depth int, msg string) error
- func NewWithDepthf(depth int, format string, args ...interface{}) error
- func Newf(format string, args ...interface{}) error
- func WithMessage(err error, msg string) error
- func WithMessagef(err error, format string, args ...interface{}) error
- func Wrap(err error, msg string) error
- func WrapWithDepth(depth int, err error, msg string) error
- func WrapWithDepthf(depth int, err error, format string, args ...interface{}) error
- func Wrapf(err error, format string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertionFailedWithDepthf ¶
AssertionFailedWithDepthf creates an internal error with a stack trace collected at the specified depth. See the doc of `AssertionFailedf()` for more details.
func AssertionFailedf ¶
AssertionFailedf creates an internal error.
Detail is shown: - via `errors.GetSafeDetails()`, shows redacted strings. - when formatting with `%+v`. - in Sentry reports.
func New ¶
New creates an error with a simple error message. A stack trace is retained.
Detail output: - message via `Error()` and formatting using `%v`/`%s`/`%q`. - everything when formatting with `%+v`. - stack trace (not message) via `errors.GetSafeDetails()`. - stack trace (not message) in Sentry reports.
func NewAssertionErrorWithWrappedErrDepthf ¶
func NewAssertionErrorWithWrappedErrDepthf( depth int, origErr error, format string, args ...interface{}, ) error
NewAssertionErrorWithWrappedErrDepthf is like NewAssertionErrorWithWrappedErrf but the depth at which the call stack is captured can be specified. See the doc of `AssertionFailedf()` for more details.
func NewAssertionErrorWithWrappedErrf ¶
NewAssertionErrorWithWrappedErrf wraps an error and turns it into an assertion error. Both details from the original error and the context of the caller are preserved. The original error is not visible as cause any more. The original error message is preserved. See the doc of `AssertionFailedf()` for more details.
func NewWithDepth ¶
NewWithDepth is like New() except the depth to capture the stack trace is configurable. See the doc of `New()` for more details.
func NewWithDepthf ¶
NewWithDepthf is like Newf() except the depth to capture the stack trace is configurable. See the doc of `New()` for more details.
func Newf ¶
Newf creates an error with a formatted error message. A stack trace is retained. See the doc of `New()` for more details.
func WithMessage ¶
WithMessage wraps an error with a simple error message prefix.
Detail output: - message prefix via `Error()` and formatting using `%v`/`%s`/`%q`.
func WithMessagef ¶
WithMessagef wraps an error with a simple error message prefix.
func Wrap ¶
Wrap wraps an error with a message prefix. A stack trace is retained.
Detail output: - original error message + prefix via `Error()` and formatting using `%v`/`%s`/`%q`. - everything when formatting with `%+v`. - stack trace (not message) via `errors.GetSafeDetails()`. - stack trace (not message) in Sentry reports.
func WrapWithDepth ¶
WrapWithDepth is like Wrap except the depth to capture the stack trace is configurable. The the doc of `Wrap()` for more details.
func WrapWithDepthf ¶
WrapWithDepthf is like Wrapf except the depth to capture the stack trace is configurable. The the doc of `Wrapf()` for more details.
func Wrapf ¶
Wrapf wraps an error with a formatted message prefix. A stack trace is also retained. If the format is empty, no prefix is added, but the extra arguments are still processed for reportable strings.
Detail output: - original error message + prefix via `Error()` and formatting using `%v`/`%s`/`%q`. - everything when formatting with `%+v`. - stack trace (not message) and redacted details via `errors.GetSafeDetails()`. - stack trace (not message) and redacted details in Sentry reports.
Types ¶
This section is empty.