errors

package
v2.26.0-RC1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errors contains functionality for creating and wrapping errors with improved formatting compared to the standard Go error functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

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

Errorf returns an error with a message formatted according to the format specifier.

func New

func New(message string) error

New returns an error with the given message.

func SetTopLevelMsg

func SetTopLevelMsg(err error, top string) error

SetTopLevelMsg returns a new error with the given top level message. The top level message is the first error message that gets printed when Error() is called on the returned error or any error wrapping it.

func SetTopLevelMsgf

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

SetTopLevelMsgf returns a new error with the given top level message according to the format specifier. The top level message is the first error message that gets printed when Error() is called on the returned error or any error wrapping it.

func WithContext

func WithContext(err error, context string) error

WithContext returns a new error adding additional context to err.

func WithContextf

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

WithContextf returns a new error adding additional context to err according to the format specifier.

func Wrap

func Wrap(err error, message string) error

Wrap returns a new error annotating err with a new message.

func Wrapf

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

Wrapf returns a new error annotating err with a new message according to the format specifier.

Types

This section is empty.

Jump to

Keyboard shortcuts

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