Use reject instead of throw

This ensures that the containing promise is rejected without triggering
the side effects of an uncaught exception, such as causing the debugger
to pause.

// FREEBIE
This commit is contained in:
lilia 2015-10-03 23:19:53 -07:00
parent a32f3ff1f6
commit 1345899253
2 changed files with 2 additions and 2 deletions

View file

@ -39305,7 +39305,7 @@ MessageReceiver.prototype = {
ev.error = error; ev.error = error;
ev.proto = envelope; ev.proto = envelope;
this.dispatchEvent(ev); this.dispatchEvent(ev);
throw error; // reject this promise return Promise.reject(error);
}.bind(this)); }.bind(this));
}, },
handleSentMessage: function(destination, timestamp, message) { handleSentMessage: function(destination, timestamp, message) {

View file

@ -111,7 +111,7 @@ MessageReceiver.prototype = {
ev.error = error; ev.error = error;
ev.proto = envelope; ev.proto = envelope;
this.dispatchEvent(ev); this.dispatchEvent(ev);
throw error; // reject this promise return Promise.reject(error);
}.bind(this)); }.bind(this));
}, },
handleSentMessage: function(destination, timestamp, message) { handleSentMessage: function(destination, timestamp, message) {