This repository was archived by the owner on Dec 1, 2021. It is now read-only.
errors 0.7.0
What's new since version 0.6.0
0.7.0 removes the deprecated errors.Location and errors.Stack interfaces, and the errors.Fprint helper. Types returned from this package now implement the fmt.Formatter interface and can print themselves when passed to fmt.Printf and friends.
For example:
fmt.Printf("%s\n", err)will print the message of the error as per normal, recursive if the underlying error has aCausemethod.fmt.Printf(%v\n", err)operates the same as%s.fmt.Printf(%+v\n", err)prints the error message as above, then prints a stack trace of the point that the error was created witherrors.New,errors.Errorf, etc.
This new behaviour is described in this blog post.
Other changes in 0.7.0 include:
- The
Stacktrace() []Frameinterface method was renamed toStackTrace() StackTrace. Please note the change in capitalisation. The previous interface was added in 0.6.0 so hopefully this change will not cause to many breaking changes. The name and signature of the method is not expected to change again in the future. Fixes #50.
Bug fixes
README.mdincorrectly reported the licence of this package as MIT, not BSD 2 clause, this has been rectified. Thanks @anthonyfok. Fixes #41.