Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

errors 0.7.0

Compare
Choose a tag to compare
@davecheney davecheney released this 14 Jun 06:29
· 73 commits to master since this release

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 a Cause method.
  • 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 with errors.New, errors.Errorf, etc.

This new behaviour is described in this blog post.

Other changes in 0.7.0 include:

  • The Stacktrace() []Frame interface method was renamed to StackTrace() 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.md incorrectly reported the licence of this package as MIT, not BSD 2 clause, this has been rectified. Thanks @anthonyfok. Fixes #41.