errutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 9

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertionFailedWithDepthf

func AssertionFailedWithDepthf(depth int, format string, args ...interface{}) error

AssertionFailedWithDepthf creates an internal error with a stack trace collected at the specified depth.

func AssertionFailedf

func AssertionFailedf(format string, args ...interface{}) error

AssertionFailedf creates an internal error.

func New

func New(msg string) error

New creates an error with a simple error message. A stack trace is retained.

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.

func NewAssertionErrorWithWrappedErrf

func NewAssertionErrorWithWrappedErrf(origErr error, format string, args ...interface{}) error

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.

func NewWithDepth

func NewWithDepth(depth int, msg string) error

NewWithDepth is like New() except the depth to capture the stack trace is configurable.

func NewWithDepthf

func NewWithDepthf(depth int, format string, args ...interface{}) error

NewWithDepthf is like Newf() except the depth to capture the stack trace is configurable.

func Newf

func Newf(format string, args ...interface{}) error

Newf creates an error with a formatted error message. A stack trace is retained.

func WithMessage

func WithMessage(err error, msg string) error

WithMessage wraps an error with a simple error message prefix.

func WithMessagef

func WithMessagef(err error, format string, args ...interface{}) error

WithMessagef wraps an error with a simple error message prefix.

func Wrap

func Wrap(err error, msg string) error

Wrap wraps an error with a message prefix. A stack trace is retained.

func WrapWithDepth

func WrapWithDepth(depth int, err error, msg string) error

WrapWithDepth is like Wrap except the depth to capture the stack trace is configurable.

func WrapWithDepthf

func WrapWithDepthf(depth int, err error, format string, args ...interface{}) error

WrapWithDepthf is like Wrapf except the depth to capture the stack trace is configurable.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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