From 3604f19eb9d828d5c5e0ef279ab12c65036151a7 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Fri, 7 Mar 2014 23:04:22 +0100 Subject: [PATCH] Add onerror handler to Worker to see uncaught errors --- src/worker/async_proxy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/worker/async_proxy.js b/src/worker/async_proxy.js index e5235644..59507545 100644 --- a/src/worker/async_proxy.js +++ b/src/worker/async_proxy.js @@ -41,6 +41,9 @@ var INITIAL_RANDOM_SEED = 50000, // random bytes seeded to worker function AsyncProxy(path) { this.worker = new Worker(path || 'openpgp.worker.js'); this.worker.onmessage = this.onMessage.bind(this); + this.worker.onerror = function(e) { + throw new Error('Unhandled error in openpgp worker: ' + e.message + ' (' + e.filename + ':' + e.lineno + ')'); + }; this.seedRandom(INITIAL_RANDOM_SEED); // FIFO this.tasks = [];