-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
secondary: add SummarizeErrors variadic method
I was recently debugging a workflow with lots of async workers able to cancel each other, so that by the time an error bubbled up it was ambiguous where the longest stack would be and whether there were errors in two places because one wrapped the other or because of two separate root errors. I felt like what would be most convenient would be to smoosh everything together rather than try to be too smart about it. This PR implements SummarizeErrors, which is mainly the generalization of CombineErrors over n errors. If one argument is detectably already wrapping another, the result will ignore the latter. If two errors are distinct but both wrapping the same error, the result will preserve that information. Two errors are distinct if err1 != err2; there didn't look to be much benefit in bringing in things like .Is as we're really interested in identity, not equivalence.
- Loading branch information
Showing
3 changed files
with
95 additions
and
0 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
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