-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(timeout): remove errorToSend
argument, always throw TimeoutError
#2172
Conversation
@@ -97,6 +93,6 @@ class TimeoutSubscriber<T> extends Subscriber<T> { | |||
} | |||
|
|||
notifyTimeout(): void { | |||
this.error(this.errorToSend); | |||
this.error(new TimeoutError()); |
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.
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.
Why allocate an object you don't need?
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.
Not sure which object is unused, pr #2132 is simply changing where error object is created and pass into here. Would you elaborate bit what I'm missing?
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.
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 see. Makes sense.
The coverage results seem to be just the unfortunate math of removing a few tests we didn't need. I'm not worried about it. |
The `errorToSend` argument did not make much sense, so we are removing it ahead of the 5.0 release. All timeout errors will be thrown as `TimeoutError`, which can be tested with an assertion against `instanceof Rx.TimeoutError`. BREAKING CHANGE: `timeout` no longer accepts the `errorToSend` argument related #2141
LGTM |
Note to anyone else who was using the errorToSend argument to create a contextual error message.
Quite a lot more lines I know. |
Also @benlesh why did the errorToSend argument not make any sense? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
errorToSend
argument did not make much sense, so we are removing it ahead of the 5.0 release. All timeout errors will be thrown asTimeoutError
, which can be tested with an assertion againstinstanceof Rx.TimeoutError
.BREAKING CHANGE:
timeout
no longer accepts theerrorToSend
argumentrelated #2141