11/*
2- Package errors provides simple, concise, useful error handling and annotation.
2+ Package errors provides simple, concise, useful error handling and annotation. This package
3+ aims to implement the Error Inspection and Error Values Go2 draft designs.
4+
5+ https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md
6+ https://go.googlesource.com/proposal/+/master/design/go2draft.md
37
48 import (
5- errs "github.com/mkenney/go- errors"
9+ "github.com/bdlm/ errors/v2 "
610 )
711
812One of the biggest frustrations with Go error handling is the lack of forensic and meta
9- information errors can provide. Out of the box errors are just a string and possibly a type.
13+ information errors should provide. By default errors are just a string and possibly a type.
1014They can't tell you where they occurred or the path through the call stack they followed.
1115The error implementation in Go is robust enough to control program flow but it's not very
1216efficient for troubleshooting or analysis.
@@ -17,11 +21,19 @@ Since the idom in Go is that we pass the error back up the stack anyway:
1721 return err
1822 }
1923
20- it's trivial to make errors much more informative with a simple error package. This package
21- makes this easy and supports tracing the call stack and the error callers with relative
22- ease. Custom error types are also fully compatible with this package and can be used freely.
24+ it's trivial to make errors much more informative with a simple error package. `bdlm/errors`
25+ makes this easy and supports tracing the call stack and the error callers with relative ease.
26+ Custom error types are also fully compatible with this package and can be used freely.
27+
28+ Install
29+
30+ go get github.com/bdlm/errors/v2
31+
32+ Quick Start
2333
24- Quick start
34+ All package methods work with any `error` type as well as `nil` values, and error instances
35+ implement the Unwrap, Is, Marshaler, and Formatter interfaces as well as the github.com/bdlm/std/errors
36+ interfaces.
2537
2638Create an error:
2739
0 commit comments