Closed
Bug 1726363
Opened 4 years ago
Closed 4 years ago
Always return rejected promise from async callback when throwing
Categories
(Core :: DOM: Bindings (WebIDL), enhancement)
Core
DOM: Bindings (WebIDL)
Tracking
()
RESOLVED
DUPLICATE
of bug 1726595
People
(Reporter: saschanaz, Unassigned)
References
Details
Say that there is a callback type that returns a promise:
interface LockManager {
Promise<any> request(DOMString name,
LockGrantedCallback callback);
};
callback LockGrantedCallback = Promise<any> (Lock? lock);
Currently the way to get the result from aCallback.Call() for the following each case is different:
locks.request("foo", () => { throw new Error("error"); });
locks.request("foo", async () => { throw new Error("error"); });
- Call() will pass the exception to its ErrorResult argument and the return value is nullptr.
- Call() will return a rejected promise.
I don't think there is a good reason to differentiate 1 and 2, and it would be great if Call() always return a promise in this case, just as general return values are always wrapped by Promises.
Updated•4 years ago
|
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•