-
Notifications
You must be signed in to change notification settings - Fork 593
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
Update checkedCast in JS/TS #2553
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.
Looks good
js/src/Ice/ObjectPrxExtensions.js
Outdated
.catch((ex) => { | ||
if (ex instanceof FacetNotExistException) { | ||
r.resolve(null); | ||
} else { | ||
r.reject(ex); | ||
} | ||
r.reject(ex); |
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.
Is this still necessary?
My understanding is that Promise::catch
is only called for reject
ed promises anyways.
So this feels alot like a pointless catch(ex) { throw ex; }
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.
we can write it as:
prx.ice_isA(this.ice_staticId(), ctx).then(
(ret) => r.resolve(ret ? new this(prx) : null),
(ex) => r.reject(ex),
);
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.
Ah yes, because r
is a different promise than the one being returned by the ice_isA
operation. I'd missed that before.
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.
Updated code using Jose's suggestion, except without parenthesis around ret and ex.
Fixes #2323 in JS/TS.