Skip to content
extension of errors
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
annotate.go
annotate_test.go
coderr.go
coderr_test.go
codes.go
codes_test.go
errors.go
errors_test.go
from.go
from_test.go
go.mod
go.sum

README.md

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 by value
  • error with stack

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)

//pure value error
e4 := errors.ValueErr(5)
v4 := errors.ValueFrom(e4)
You can’t perform that action at this time.