diff --git a/notebook/static/services/kernels/comm.js b/notebook/static/services/kernels/comm.js index 6326a3766..6f406807b 100644 --- a/notebook/static/services/kernels/comm.js +++ b/notebook/static/services/kernels/comm.js @@ -128,12 +128,9 @@ define([ } this.comms[content.comm_id] = this.comms[content.comm_id].then(function(comm) { - try { - comm.handle_msg(msg); - } catch (e) { - console.log("Exception handling comm msg: ", e, e.stack, msg); - } - return comm; + return (Promise.resolve(comm.handle_msg(msg)) + .catch(utils.reject('Exception handling comm message')) + .then(function() {return comm;})); }); return this.comms[content.comm_id]; }; @@ -193,7 +190,7 @@ define([ var callback = this['_' + key + '_callback']; if (callback) { try { - callback(msg); + return callback(msg); } catch (e) { console.log("Exception in Comm callback", e, e.stack, msg); } @@ -201,7 +198,7 @@ define([ }; Comm.prototype.handle_msg = function (msg) { - this._callback('msg', msg); + return this._callback('msg', msg); }; Comm.prototype.handle_close = function (msg) {