From 83e3cff2c477a2063a8a8ba0cd68aea078a29a06 Mon Sep 17 00:00:00 2001 From: Molly Lloyd Date: Fri, 9 Feb 2018 11:28:32 -0800 Subject: [PATCH] fix web worker error handling --- src/util/actor.js | 4 ++-- src/util/web_worker_transfer.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/actor.js b/src/util/actor.js index b5fcdd868d3..e4cd66a2a96 100644 --- a/src/util/actor.js +++ b/src/util/actor.js @@ -69,7 +69,7 @@ class Actor { sourceMapId: this.mapId, type: '', id: String(id), - error: err ? String(err) : null, + error: err ? serialize(err) : null, data: serialize(data, buffers) }, buffers); }; @@ -78,7 +78,7 @@ class Actor { callback = this.callbacks[data.id]; delete this.callbacks[data.id]; if (callback && data.error) { - callback(new Error(data.error)); + callback(deserialize(data.error)); } else if (callback) { callback(null, deserialize(data.data)); } diff --git a/src/util/web_worker_transfer.js b/src/util/web_worker_transfer.js index d510691d4b8..9357c0f2fc5 100644 --- a/src/util/web_worker_transfer.js +++ b/src/util/web_worker_transfer.js @@ -87,6 +87,7 @@ Grid.deserialize = function deserializeGrid(serialized: ArrayBuffer): Grid { register('Grid', Grid); register('Color', Color); +register('Error', Error); register('StylePropertyFunction', StylePropertyFunction); register('StyleExpression', StyleExpression, {omit: ['_evaluator']});