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

Refactor errdefs with an API more similar to the standard library #14

Closed
wants to merge 1 commit into from

Commits on Jul 16, 2024

  1. Refactor errdefs with an API more similar to the standard library

    This updates errdefs to have an API similar to the standard library. The
    `New` method is the equivalent of `fmt.Errorf` and `Join` is the
    equivalent of `errors.Join`.
    
    These methods also support the proper output of stack traces by ensuring
    the proper handling of the formatting for collapsible errors.
    
    Similarly, the `stack` package has been updated to remove the
    context-based helper and instead directly expose the function that
    creates the stack error. The stack error is also renamed to `Error` and
    exposed rather than left unexported.
    
    The `stack` package can be used to directly create errors with stacks
    when one isn't present. It is also possible to add multiple stacks to a
    single error through `errdefs.Join` and `errdefs.ErrStack` to manually
    create a stack error.
    
    Signed-off-by: Jonathan A. Sternberg <[email protected]>
    jsternberg committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    e18cf8f View commit details
    Browse the repository at this point in the history