-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsTimeout method to Error #903
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a CHANGELOG entry.
Also recommend updating one of the existing tests to use this too:
find a test that checks Code() == ..TimedOut,
in that test also add IsTimeout().
Why keep the old way? Because we want to make sure that we're not breaking existing functionality.
471dc28
to
e0dc3df
Compare
@@ -295,6 +295,9 @@ func TestConsumerAssignment(t *testing.T) { | |||
if err.(Error).Code() != ErrTimedOut { | |||
t.Errorf("Expected ReadMessage to fail with ErrTimedOut, not %v", err) | |||
} | |||
if !err.(Error).IsTimeout() { | |||
t.Errorf("Expected ReadMessage to fail with a timeout error, not %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a case for the success case too. E.g., from the TestConsumerAPIs dry-test (doesn't require a broker), you could call ReadMessage() with a low timeout and verify it is a timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit unsure if I got this right since the case in TestConsumerAssignment
is also a success case (ie it's a timeout).
I added a test in TestConsumerAPIs, hopefully that captures the intent of this comment.
This convenience method just checks if Error code is ErrTimedOut/ErrTimedOutQueue. Also modifies the example in README.md. Modifies the CHANGELOG.md.
e0dc3df
to
30eed3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This convenience method just checks if Error code is ErrTimedOut/ErrTimedOutQueue. Also modifies the example in README.md. Modifies the CHANGELOG.md.
This convenience method just checks if Error code is ErrTimedOut/ErrTimedOutQueue. Also modifies the example in README.md. Modifies the CHANGELOG.md.
This convenience method just checks if Error code is ErrTimedOut.
Also modifies the example in README.md.
See #846 (comment)