errors

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 30

Documentation

Overview

Contains utilities to use to create and consume simple errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(errorCode ErrorCode, msgFmt string, args ...interface{}) error

Creates a new error using an error code and a message.

func IsCausedBy

func IsCausedBy(e error, errCode ErrorCode) bool

Gets whether error is caused by another error with errCode.

func IsCausedByError

func IsCausedByError(e, e2 error) bool

func Wrapf

func Wrapf(code ErrorCode, cause error, msgFmt string, args ...interface{}) error

Wraps a root cause error with another. This is useful to unify an error type in a package.

Types

type ErrorCode

type ErrorCode = string

A generic error code type.

func GetErrorCode

func GetErrorCode(e error) (code ErrorCode, found bool)

Gets the error code of the passed error if it has one.

type ErrorCollection added in v0.3.12

type ErrorCollection []error

A helper object that collects errors.

func (*ErrorCollection) Append added in v0.3.12

func (e *ErrorCollection) Append(err error) bool

func (ErrorCollection) Error added in v0.3.12

func (e ErrorCollection) Error() string

func (ErrorCollection) ErrorOrDefault added in v0.3.12

func (e ErrorCollection) ErrorOrDefault() error

Jump to

Keyboard shortcuts

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