Bug 1458731 - Print actor's typeName and name of the throwing method when an exception is thrown by a protocol.js's actor. r=jlast,jryans

MozReview-Commit-ID: 5poQ0F1dJVu

--HG--
extra : rebase_source : dcf0cb83559fec2e3f92fe777a3bb630e098f7d4
This commit is contained in:
Alexandre Poirot 2018-05-09 03:44:54 -07:00
parent eb823e257d
commit 191bf836a1

View File

@ -1012,10 +1012,11 @@ Actor.prototype = extend(Pool.prototype, {
return { actor: this.actorID };
},
writeError: function(error) {
console.error(error);
writeError: function(error, typeName, method) {
console.error(`Error while calling actor '${typeName}'s method '${method}'`,
error.message);
if (error.stack) {
dump(error.stack);
console.error(error.stack);
}
this.conn.send({
from: this.actorID,
@ -1176,7 +1177,7 @@ var generateRequestHandlers = function(actorSpec, actorProto) {
try {
this.destroy();
} catch (e) {
this.writeError(e);
this.writeError(e, actorProto.typeName, spec.name);
return;
}
}
@ -1188,11 +1189,11 @@ var generateRequestHandlers = function(actorSpec, actorProto) {
return p
.then(() => ret)
.then(sendReturn)
.catch(e => this.writeError(e));
.catch(e => this.writeError(e, actorProto.typeName, spec.name));
});
} catch (e) {
this._queueResponse(p => {
return p.then(() => this.writeError(e));
return p.then(() => this.writeError(e, actorProto.typeName, spec.name));
});
}
};