-
Notifications
You must be signed in to change notification settings - Fork 6
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
[errors] Replace pkg/errors Fix #54 #59
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- #54 - hashicorp/errwrap supports get/check error by message or type and walk - which is more handy than just get the root cause - hashicorp/go-multierror can faltten multierror when append - ErrOrNil, because nil pointer is not nil error - https://golang.org/doc/faq#nil_error Why is my nil error value not equal to nil? - uber/multierr - [ ] has a atomic value to deal with copy? - is trying to integrate with zap - suggests return two value when append
- safe version is guarded by a mutex, and make a copy of errors when `Errors` is called - unsafe (default) version just `errs = append(errs, err)` and return the underlying slice directly (no copy) when `Errors` is called - flatten is supported, when append, check if it's a MultiErr interface
- otherwise the `// Code generated ...` will be treated as package comment - this may be intended behavior for protobuf, but not for gommon in most cases - [doc] update the doc for most packages, most of them were blank
- [ ] FIXME: runtime.Frames can only be read once
- when use *runtime.Frames, it can only be read once - the drawback is, we many not always need the full frames - actually a lot of time the full stack is never printed ...
- when `Frames()` is not called, *runtime.Frames is not traversed - it should increase performance (in theory) ...
- since the methods are same, `Wrap` and `Wrapf`, most files only need to change the import path - all the `WithMessage` are replaced with `Wrap` because we check existing stack before attach stack to error
- add `HasError` to avoid writing `ErrorOrNil != nil`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODO in next PR