Categorygithub.com/x-mod/errors
modulepackage
0.2.3
Repository: https://github.com/x-mod/errors.git
Documentation: pkg.go.dev

# README

errors

Build Status Go Report Card Coverage Status GoDoc

extension of errors for the following features:

  • annotation error
  • error with code, support grpc error code
  • error with stack use pkg/errors

Quick Start


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

//annotation error
e1 := errors.Annotate(err, "annotations")
e11 := errors.Annotatef(err, "annotations %s", "format")

//code error
e2 := errors.WithCode(err, YourCode)
//get error's code value
v2 := errors.ValueFrom(e2)

e3 := errors.WithStack(err)
//print stack info
fmt.Printf("%+v", e3)

# Functions

Annotate an error with annotation.
Annotatef an error with annotation.
As standard func.
CodeError a new error from code.
Errorf standard func.
Is standard func.
New errorstring error.
Unwrap standard func.
ValueFrom get code from the errorsupport code value from grpc status.
WithCode wrap err with code.

# Interfaces

Code interface.

# Type aliases

No description provided by the author