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

Annotate errors #9

Open
ferhatelmas opened this issue Sep 6, 2019 · 5 comments
Open

Annotate errors #9

ferhatelmas opened this issue Sep 6, 2019 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ferhatelmas
Copy link
Contributor

to provide more context to the users.

pkg/errors could be leveraged.

@tbarbugli
Copy link
Member

do you have an example?

@tbarbugli tbarbugli added the enhancement New feature or request label Sep 6, 2019
@ferhatelmas
Copy link
Contributor Author

For example, client has an error in Do, the caller of Do just returns the error but it could do Wrap or WithMessage to signal where that error had happened.

https://github.com/cockroachdb/errors is another package that can do this job and is more future proof than pkg/errors comparatively (by having go1.13 helpers)

@pascaldekloe
Copy link

Why not use the fmt.Errorf %w directive? 😃

@ferhatelmas
Copy link
Contributor Author

Yes, it's a good idea but I'm not sure about the target go versions. Above packages would work in old versions but %w directive requires 1.13 and above.

Also, I believe 1.13 adaptation will be much slower compared to previous versions due to modules, GOPROXY and GOPRIVATE.

@bdandy
Copy link
Contributor

bdandy commented Sep 10, 2019

I've heard about cocroachdb/errors library, it looks very great, but I've never used it before.
pkg/errors was awesome for that 👍

@ferhatelmas ferhatelmas added the help wanted Extra attention is needed label Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants