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

Do not show stack trace when using pkg/error #625

Closed
jszwedko opened this issue Apr 24, 2017 · 3 comments
Closed

Do not show stack trace when using pkg/error #625

jszwedko opened this issue Apr 24, 2017 · 3 comments
Labels
help wanted please help if you can! kind/bug describes or fixes a bug

Comments

@jszwedko
Copy link
Contributor

This functionality was added in #560, but #558 (comment) points out that this shows the stack trace to the end-user by default which is generally not desirable.

@jszwedko jszwedko added kind/bug describes or fixes a bug help wanted please help if you can! labels Apr 24, 2017
@mh-cbon
Copy link
Contributor

mh-cbon commented Apr 25, 2017

hi,

what if instead the package provides some error handlers in order to let the user decide what to do with the error.

Before that change about pkg/errors, there was just no such data available.
Now, there s too much data.
I think, it is only lacking of handling.

Where an error handler could detect that this error is stacktraced, thus appropriately handle it.
An handler which would be bale to read some env to display full stack en dev, partial stack/nostack on production.
To go further a parsing error might return file/line/pos, and an error handler detecting that might print a more appropriate error to the end user, in a generic way.

But, this does not really help current users in the sense that they ll need to appropriately return typed error to trigger the appropriate display behavior.

That being said, a default error handler might be defined to reproduce old behavior.
Other users would then subscribe the handlers they are interested into to replace that default.

@mh-cbon
Copy link
Contributor

mh-cbon commented Apr 25, 2017

To add some example,

3 kind of error output,

$ myprogram
wrong arguments
// I don t want more except maybe help section of the man.

$ myprogram
panic(...)
// I expect to get a trace

$ myprogram
wrong syntax at xx ll:pp
// here you might want to show the source and point the place.

@coilysiren
Copy link
Member

Given that this is from last year, I think I'm comfortable closing it 🙂 feel free to re-open / open a new issue / comment in support if there's still interest here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted please help if you can! kind/bug describes or fixes a bug
Projects
None yet
Development

No branches or pull requests

4 participants