secondary

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineErrors added in v1.1.0

func CombineErrors(err error, otherErr error) error

CombineErrors returns err, or, if err is nil, otherErr. if err is non-nil, otherErr is attached as secondary error. See the documentation of `WithSecondaryError()` for details.

func WithSecondaryError

func WithSecondaryError(err error, additionalErr error) error

WithSecondaryError enhances the error given as first argument with an annotation that carries the error given as second argument. The second error does not participate in cause analysis (Is, etc) and is only revealed when printing out the error or collecting safe (PII-free) details for reporting.

If additionalErr is nil, the first error is returned as-is.

Tip: consider using CombineErrors() below in the general case.

Detail is shown: - via `errors.GetSafeDetails()`, shows details from secondary error. - when formatting with `%+v`. - in Sentry reports.

Types

This section is empty.

Jump to

Keyboard shortcuts

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