зеркало из https://github.com/mozilla/gecko-dev.git
Bug 981875 - Improve error _PromiseWorker's error reporting in case of xpcom error. r=froydnj
This commit is contained in:
Родитель
b18977ba7e
Коммит
38421c7ca4
|
@ -176,8 +176,18 @@ PromiseWorker.prototype = {
|
|||
let id = ++this._id;
|
||||
let message = {fun: fun, args: array, id: id};
|
||||
this._log("Posting message", message);
|
||||
try {
|
||||
this._worker.postMessage(message);
|
||||
} catch (ex if typeof ex == "number") {
|
||||
this._log("Could not post message", message, "due to xpcom error", ex);
|
||||
// handle raw xpcom errors (see eg bug 961317)
|
||||
return Promise.reject(new Components.Exception("Error in postMessage", ex));
|
||||
} catch (ex) {
|
||||
this._log("Could not post message", message, "due to error", ex);
|
||||
return Promise.reject(ex);
|
||||
}
|
||||
|
||||
this._queue.push({deferred:deferred, closure: closure, id: id});
|
||||
this._worker.postMessage(message);
|
||||
this._log("Message posted");
|
||||
return deferred.promise;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче