-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Concurrent functions return multiple errors. These are now returned only as either a channel or a slice. This avoids a dependency on a 3rd party multi errors library. The standard library errors.Join is awkward to use because there is not a simple way to unwrap the errors. We could use a custom multi error. However, to make this convenient to use it should be returned as a pointer to the struct rather than an opaque error. But Go has a subtle design issue where an interface can end up being non-nil when storing a pointer to a struct. Returning []error still allows the caller to use errors.Join() if they don't care about iterating the individual errors. The main issue is that someone may check != nil rather than len > 0 However, all the APIs are designed to return nil rather than a zero length slice. Additionally, don't use the default recovery handler. Write more errors to the error channels. Panic a few errors that shouldn't happen.
- Loading branch information
Greg Weber
committed
Oct 29, 2024
1 parent
352789c
commit 2cf6934
Showing
5 changed files
with
371 additions
and
237 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
Oops, something went wrong.