forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common: Fix fmt msg lost in AppendError().Error()
Retain the .msg field of a go fmt.Errorf .msg field returned by .Error() when wrapping multiple errors. This fixes a situation where a nested stack of errors would lose formatting information, which is often used to supply identifying context. e.g. ``` err = fmt.Errorf("%w `%s`: %w", errParsingField, fieldName, parsingError) errs = common.AppendError(errs, err) ``` This isn't really an issue with our implementation; Calling Unwrap() on a fmt.Errorf() which returns a wrapErrors will lose that formatting. Our issue was that we were using just Unwrap() to bind together our chain-of-custody.
- Loading branch information
Showing
2 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
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
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