-
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
fix(ajax): RxJS v6 TimeoutError is missing name property #3656
Conversation
Note this doesn't fix #3602, as that uses a different error. |
Ah I see, that is my mistake. I will look into a better fix that will cover the |
Updated to fix Also noticed that some of the tests that are implemented like the following are not hitting some of the expectations:. This test will still pass. result.subscribe(() => {
throw new Error('this should not next');
}, err => {
// Never actually getting tested
expect(err).to.be.an.instanceof(Rx.TimeoutError);
expect(err.name).to.equal('BlahBlahBlah');
}, () => {
throw new Error('this should not complete');
}); I updated as follows to get the assertions to actually hit. Seen this pattern elsewhere in the tests. let error;
result.subscribe(() => {
throw new Error('this should not next');
}, err => {
error = err;
}, () => {
throw new Error('this should not complete');
});
rxTestScheduler.flush();
expect(error).to.be.an.instanceof(Rx.TimeoutError);
expect(error.name).to.equal('TimeoutError'); |
src/internal/util/TimeoutError.ts
Outdated
this.name = 'TimeoutError'; | ||
(Object as any).setPrototypeOf(this, TimeoutError.prototype); | ||
} | ||
} |
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.
did line endings change in this file?
ae7e748
to
44042d0
Compare
Thank you, @bbonnet! |
@@ -8,7 +8,7 @@ | |||
export class TimeoutError extends Error { | |||
constructor() { | |||
super('Timeout has occurred'); | |||
|
|||
this.name = '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.
it would be nice if this was declared as a property so it is a visible part of the API contract:
public readonly name: 'TimeoutError' = '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.
@felixfbecker Following up with that here: #3678
Description:
Update the
name
property of theAjaxTimeoutError
to be "AjaxTimeoutError" instead of "AjaxError".@felixfbecker mentioned the following in the original issue:
This still will cause problems if the implementation name changes. Open to feedback for a more permanent solution.
Related issue (if exists):
#3602