-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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 timeout and unit to TimeoutException message #6234
Add timeout and unit to TimeoutException message #6234
Conversation
I'm for better error messages but I'm not convinced a timeout value is generally unique enough in a project that will allow you to locate the flow. Especially when the timeout value comes from configuration and thus it is not prevalent in the source code. An alternative would be an overload on the operator with a String argument that would be passed onto the exception constructor, tagging the particular source location. |
Codecov Report
@@ Coverage Diff @@
## 2.x #6234 +/- ##
============================================
- Coverage 98.26% 98.21% -0.05%
+ Complexity 6201 6200 -1
============================================
Files 667 667
Lines 44883 44887 +4
Branches 6216 6216
============================================
- Hits 44103 44088 -15
- Misses 243 261 +18
- Partials 537 538 +1
Continue to review full report at Codecov.
|
I like your suggestion, I still however think that adding timeout and value is a good option for now and for the case when user didn't specify a message. This will be a "free" improvement for existing users who will just receive it with an update of the library and 0 changes in their code.
Often times these configurations are traceable, thus knowing the values can be helpful enough. But still, optional message sounds good to me, I can work on it once we decide on the destiny of this PR |
Okay, let's have a default message for now, but more like along these lines:
|
sgtm, implementing |
@@ -82,26 +83,24 @@ public void shouldNotTimeoutIfSecondOnNextWithinTimeout() { | |||
|
|||
@Test | |||
public void shouldTimeoutIfOnNextNotWithinTimeout() { | |||
Subscriber<String> subscriber = TestHelper.mockSubscriber(); |
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.
Here and below I'm not sure what's the purpose of mocking, TestSubscriber/TestObserver are capable of checking what's needed in these test cases
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.
Probably some v1 hybrid remnant.
I've updated the message and added tests, turns out in some cases we didn't check for @vanniktech please take a look again |
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.
Nice even getting rid of some mockito nonsense.
This is a small enhancement to help with crash/log debugging.
Right now often times you get a stacktrace that points only to RxJava:
Adding
timeout
andunit
values can help find related user code faster.I'm not advocating for particular message, it can be something even shorter, like
$timeout $unit
.It can also be extracted in a method if you see value in that.