Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure wrapping nil is still nil #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Mar 21, 2023

  1. Add nil is nil test

    gabrielf committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    f2f0668 View commit details
    Browse the repository at this point in the history
  2. Fix nil is nil test

    gabrielf committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    c511f43 View commit details
    Browse the repository at this point in the history
  3. Add errors.ErrorStack(err) for easy stack trace access.

    When `New`/`Wrap`/`WrapPrefix` returned `*Error` it was easy to access a stack trace with `errors.Wrap(err, 0).ErrorStack()` in cases where you knew that an error had occurred. Now that `New`/`Wrap`/`WrapPrefix` returns `error` you would have to write `errors.Wrap(err, 0).(*errors.Error).ErrorStack()` to get the same stack trace.
    
    Using the convenience function this becomes simple again: `errors.ErrorStack(err)`. Note that this will panic if err is nil so should only be used when err is known to be not nil.
    gabrielf committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    768d365 View commit details
    Browse the repository at this point in the history