errorx

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: BSD-2-Clause Imports: 5 Imported by: 0

README

errorx

FOSSA Status godoc reference

Package errorx provides frequently used errors construct (atleast for the author).

go get -v github.com/choestelus/errorx

License

BSD-2-Clause

Certain parts of this library are inspired by (or entirely copied from) various third party libraries.

Documentation

Overview

Package errorx provides frequently used error constructs in API development, with context

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type E

type E struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

E defines common error information for inspecting and displaying to various format

func New

func New(msg string) *E

New returns stub error E

func Wrap

func Wrap(err error, msg string) *E

Wrap returns an error annotating err with a stack trace at the point Wrap is called, and the supplied message. If err is nil, Wrap returns nil.

func Wrapf

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

Wrapf returns an error annotating err with a stack trace at the point Wrapf is called, and the format specifier. If err is nil, Wrapf returns nil.

func (E) Error

func (e E) Error() string

func (E) Format

func (e E) Format(s fmt.State, verb rune)

Format calls wrapped error with Format() of its own if wrapped error is not nil

func (E) Unwrap

func (e E) Unwrap() error

Unwrap returns underlying error: 1st level of nested errors

Directories

Path Synopsis
contrib

Jump to

Keyboard shortcuts

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