aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/local-message-stream.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/local-message-stream.js')
-rw-r--r--app/scripts/lib/local-message-stream.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/scripts/lib/local-message-stream.js b/app/scripts/lib/local-message-stream.js
index 42d193e04..76fedd9df 100644
--- a/app/scripts/lib/local-message-stream.js
+++ b/app/scripts/lib/local-message-stream.js
@@ -23,7 +23,7 @@ function LocalMessageDuplexStream(opts){
LocalMessageDuplexStream.prototype._onMessage = function(event){
var msg = event.data
- // console.log('LocalMessageDuplexStream ('+this._name+') - heard message...')
+ // console.log('LocalMessageDuplexStream ('+this._name+') - heard message...', event)
// validate message
if (event.origin !== location.origin) return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (event.origin !== location.origin) ')
if (typeof msg !== 'object') return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (typeof msg !== "object") ')
@@ -31,7 +31,11 @@ LocalMessageDuplexStream.prototype._onMessage = function(event){
if (!msg.data) return //console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (!msg.data) ')
// console.log('LocalMessageDuplexStream ('+this._name+') - accepted', msg.data)
// forward message
- this.push(msg.data)
+ try {
+ this.push(msg.data)
+ } catch(err) {
+ this.emit('error', err)
+ }
}
// stream plumbing