gorums icon indicating copy to clipboard operation
gorums copied to clipboard

Bug: QuorumCallError does not work with errors.Is and errors.As

Open meling opened this issue 1 year ago • 2 comments

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 Is and As methods.
  • [ ] Document the pattern to check for things like context.DeadlineExceeded etc.

meling avatar Jan 05 '25 15:01 meling

Documents to review:

meling avatar Jan 05 '25 16:01 meling

This is partially implemented; we can use the errors.Is now, but not sure about errors.As...

meling avatar Jan 12 '25 20:01 meling