зеркало из https://github.com/mozilla/gecko-dev.git
Tracebacks for async coroutines now provide a 'best guess' for where the coroutine was at the time that an exception was thrown, by showing the frame at which the generator's last continuation callback was created.
Added a 'location' property to RequestException, analogous to the 'location' property of wrapped nsIExceptions, so that tracebacks can be made for the exceptions if needed.
This commit is contained in:
Родитель
b3e8f8b8db
Коммит
3e0284ee03
|
@ -115,6 +115,7 @@ function Generator(thisArg, method, onComplete, args) {
|
|||
this._id = gCurrentId++;
|
||||
this.onComplete = onComplete;
|
||||
this._args = args;
|
||||
this._stackAtLastCallbackGen = null;
|
||||
|
||||
gOutstandingGenerators.add(this);
|
||||
|
||||
|
@ -132,6 +133,7 @@ Generator.prototype = {
|
|||
let caller = Components.stack.caller;
|
||||
let cbId = gCurrentCbId++;
|
||||
this._outstandingCbs++;
|
||||
this._stackAtLastCallbackGen = caller;
|
||||
this._log.trace(this.name + ": cb-" + cbId + " generated at:\n" +
|
||||
formatAsyncFrame(caller));
|
||||
let self = this;
|
||||
|
@ -172,7 +174,11 @@ Generator.prototype = {
|
|||
},
|
||||
|
||||
get asyncStack() {
|
||||
return ("unknown (async) :: " + this.name + "\n" +
|
||||
let cbGenText = "";
|
||||
if (this._stackAtLastCallbackGen)
|
||||
cbGenText = (" (last self.cb generated at " +
|
||||
formatAsyncFrame(this._stackAtLastCallbackGen) + ")");
|
||||
return ("unknown (async) :: " + this.name + cbGenText + "\n" +
|
||||
traceAsyncFrame(this._initFrame));
|
||||
},
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ function RequestException(resource, action, request) {
|
|||
this._resource = resource;
|
||||
this._action = action;
|
||||
this._request = request;
|
||||
this.location = Components.stack.caller;
|
||||
}
|
||||
RequestException.prototype = {
|
||||
get resource() { return this._resource; },
|
||||
|
|
Загрузка…
Ссылка в новой задаче