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

[feature] errors.Unwrap #21

@davecheney

Description

@davecheney

We have Wrap which takes an error and returns a new error which supports Cause and will return the original error.

This issue is to discuss adding a complement to Wrap, Unwrap is specified as follows

 // Unwrap reverses the Wrap process above, returning the direct cause
 // of the error. If the error does not support Cause, or the error is nil, the 
 // error value is returned unmodified.
 func Unwrap(err error) error 

For discussion

  • Is this useful enough to justify adding to the package, vs doing this with a switch statement ?
  • Is the API appropriate, specifically in the case of an error which does not have a cause.

See also #18

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions