diff options
Diffstat (limited to 'platform/node')
-rw-r--r-- | platform/node/src/node_map.cpp | 4 | ||||
-rw-r--r-- | platform/node/src/node_map.hpp | 4 | ||||
-rw-r--r-- | platform/node/test/js/map.test.js | 6 |
3 files changed, 8 insertions, 6 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 3046652c21..a3a11a1907 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -42,8 +42,8 @@ static const char* releasedMessage() { NodeBackend::NodeBackend() : HeadlessBackend(sharedDisplay()) {} -void NodeBackend::onDidFailLoadingMap() { - throw std::runtime_error("Requires a map style to be a valid style JSON"); +void NodeBackend::onDidFailLoadingMap(std::exception_ptr error) { + std::rethrow_exception(error); } void NodeMap::Init(v8::Local<v8::Object> target) { diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp index 122e491442..bfc0a7eab6 100644 --- a/platform/node/src/node_map.hpp +++ b/platform/node/src/node_map.hpp @@ -7,6 +7,8 @@ #include <mbgl/gl/headless_backend.hpp> #include <mbgl/gl/offscreen_view.hpp> +#include <exception> + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wshadow" @@ -18,7 +20,7 @@ namespace node_mbgl { class NodeBackend : public mbgl::HeadlessBackend { public: NodeBackend(); - void onDidFailLoadingMap() final; + void onDidFailLoadingMap(std::exception_ptr) final; }; class NodeMap : public Nan::ObjectWrap, diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index 145f62ef5f..e5c756adb6 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -311,11 +311,11 @@ test('Map', function(t) { t.throws(function() { map.load('foo bar'); - }, /Requires a map style to be a valid style JSON/); + }, /Failed to parse style: 1 - Invalid value./); t.throws(function() { map.load('""'); - }, /Requires a map style to be a valid style JSON/); + }, /Failed to parse style: style must be an object/); map.release(); t.end(); @@ -335,7 +335,7 @@ test('Map', function(t) { t.throws(function() { map.load('invalid'); - }, /Requires a map style to be a valid style JSON/); + }, /Failed to parse style: 0 - Invalid value./); }); t.test('accepts an empty stylesheet string', function(t) { |