aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/port-stream.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/scripts/lib/port-stream.js b/app/scripts/lib/port-stream.js
index 7f3e8072e..8ff77ec4e 100644
--- a/app/scripts/lib/port-stream.js
+++ b/app/scripts/lib/port-stream.js
@@ -37,8 +37,13 @@ PortDuplexStream.prototype._read = noop
PortDuplexStream.prototype._write = function(msg, encoding, cb){
// console.log('PortDuplexStream - sent message', msg)
- this._port.postMessage(msg)
- cb()
+ try {
+ this._port.postMessage(msg)
+ cb()
+ } catch(err){
+ // this.emit('error', err)
+ cb(new Error('PortDuplexStream - disconnected'))
+ }
}
// util