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

errors 0.8.0

Compare
Choose a tag to compare
@davecheney davecheney released this 29 Sep 02:05
· 50 commits to master since this release

What's new since version 0.7.1

errors 0.8.0 decomposes Wrap (and Wrapf) into their component operations, namely adding a message to an error, and adding a stack trace to an error, which were previously merged into a single operation.

This is accomplished by adding two top level functions, errors.WithMessage and errors.WithStack, and rewriting Wrap and Wrapf in terms of these operations.

The motivation for this change was need to treat each of the following operations as distinct:

  • Adding a context message to an existing error without altering the stack trace.
  • Adding a stack trace to an existing error without the requirement of adding an additional message.
  • Retrieving the immediate cause of an error; popping one element of the error stack.

The addition of WithStack and WithMessage increases the surface area of this package by two methods, after long discussions at GopherCon 2016 it was felt strongly that destructuring the operation of Wrap and Wrapf was necessary.

For the moment Wrap and Wrapf remain, but depending on your feedback may be deprecated in future releases. Please leave comments via the issue link.

Thanks to @nmiyake and @fabstu for their assistance in preparing this release.

Bug fixes