gorums
gorums copied to clipboard
Bug: QuorumCallError does not work with errors.Is and errors.As
This does not work as expected because QuorumCallError does not implement the Is and As methods.
// Assume err is a gorums.QuorumCallError
if errors.Is(err, context.DeadlineExceeded) {
// handle deadline exceeded
}
This needs to be fixed in QuorumCallError and possibly in quorumcall.go:
func (c RawConfiguration) QuorumCall(ctx context.Context, d QuorumCallData) (resp protoreflect.ProtoMessage, err error) {
And similar uses of the QuorumCallError in other call types.
We should use the standard Go context and error handling pattern.
Tasks:
- [ ] Implement tests for QuorumCallError with deadlines
- [ ] Implement fix for the
IsandAsmethods. - [ ] Document the pattern to check for things like
context.DeadlineExceededetc.
Documents to review:
- context package
- errors package
- Blog: Go Concurrency Patterns: Context
- Blog: Contexts and structs
- Blog: Working with Errors in Go 1.13
This is partially implemented; we can use the errors.Is now, but not sure about errors.As...