Giter Site home page Giter Site logo

[feature] errors.Unwrap about errors HOT 3 CLOSED

pkg avatar pkg commented on August 26, 2024
[feature] errors.Unwrap

from errors.

Comments (3)

powerman avatar powerman commented on August 26, 2024 2

@davecheney Maybe it's worth to reconsider this now? It may be very useful to provide Unwrap() compatible with stdlib's errors, to make it easier to migrate existing codebase from pkg/errors to stdlib's errors or use both in parallel.

I mean, I'd like to replace errors.Cause() with errors.Is() in existing code, but this require pkg/errors to support Unwrap().

from errors.

davecheney avatar davecheney commented on August 26, 2024

I'm going to close this as I think it's going in the wrong direction.

The original design of this errors package mirror'd Juju's which requires callers to manually wrap each level of error return to record a stack trace. Apart from this being incomplete and verbose, on reflection I think the natural stack trace recorded at the point the error happens is probably good enough (tm) for most use cases. In the cases where they are not, errors.Wrap allows the caller to add additional context to the error path.

In either cases the printing of this stack detail, including the nested stacks now possible since #27 makes this method less useful.

from errors.

jaekwon avatar jaekwon commented on August 26, 2024

Related proposed solution: #144

from errors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.