errors

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: MIT Imports: 5 Imported by: 14

README

errors

extension of errors for the following features:

  • annotation
  • code
  • useful interfaces

Quick Start


import "github.com/x-mod/errors"

e1 := errors.Annotate(err, "annotations")

e2 := errors.WithCode(err, code1)

code2 := errors.CodeFrom(e2)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotate

func Annotate(err error, annotation string) error

Annotate an error with annotation

func Annotatef

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

Annotatef an error with annotation

func CauseFrom

func CauseFrom(err error) error

CauseFrom get original error

func CodeError

func CodeError(code Code) error

CodeError a new error from code

func Errorf

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

Errorf standard func

func New

func New(err string) error

New errorstring error

func ValueFrom

func ValueFrom(err error) int

ValueFrom get code from the error support code value from grpc status

func WithCode

func WithCode(err error, code Code) error

WithCode wrap err with code

func WithStack

func WithStack(err error) error

WithStack error

Types

type Code

type Code interface {
	Value() int32
	String() string
}

Code interface

Jump to

Keyboard shortcuts

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