diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp
index 4aff65ff..5f0313d0 100644
--- a/src/mapnik_image.cpp
+++ b/src/mapnik_image.cpp
@@ -3220,8 +3220,9 @@ void Image::EIO_AfterFromSVGBytes(uv_work_t* req)
{
Image* im = new Image(closure->im);
v8::Local<v8::Value> ext = Nan::New<v8::External>(im);
- v8::Local<v8::Object> image_obj = Nan::New(constructor)->GetFunction()->NewInstance(1, &ext);
- v8::Local<v8::Value> argv[2] = { Nan::Null(), image_obj };
+ Nan::MaybeLocal<v8::Object> maybe_local = Nan::NewInstance(Nan::New(constructor)->GetFunction(), 1, &ext);
+ if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Image instance");
+ v8::Local<v8::Value> argv[2] = { Nan::Null(), maybe_local.ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(closure->cb), 2, argv);
}
closure->cb.Reset();
diff --git a/src/utils.hpp b/src/utils.hpp
index 643679e7..00d577f8 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -18,7 +18,7 @@
#include <mapnik/version.hpp>
#include <mapnik/params.hpp>
-#define TOSTR(obj) (*v8::String::Utf8Value((obj)->ToString()))
+#define TOSTR(obj) (*Nan::Utf8String(obj))
#define FUNCTION_ARG(I, VAR) \
if (info.Length() <= (I) || !info[I]->IsFunction()) { \
diff --git a/test/vector-tile.test.js b/test/vector-tile.test.js
index eb5ae3e3..8f1f3b41 100644
--- a/test/vector-tile.test.js
+++ b/test/vector-tile.test.js
@@ -797,59 +797,59 @@ describe('mapnik.VectorTile ', function() {
var data = fs.readFileSync("./test/data/vector_tile/tile1.vector.pbf");
vtile.setData(data);
assert.throws(
- function() { vtile.getDataSync(null); },
+ function() { vtile.getDataSync(null); }, null,
"first arg must be a options object"
);
assert.throws(
- function() { vtile.getData(null, function(err, out) {}); },
+ function() { vtile.getData(null, function(err, out) {}); }, null,
"first arg must be a options object"
);
assert.throws(
- function() { vtile.getDataSync({compression:null}); },
+ function() { vtile.getDataSync({compression:null}); }, null,
"option 'compression' must be a string, either 'gzip', or 'none' (default)"
);
assert.throws(
- function() { vtile.getData({compression:null}, function(err,out) {}); },
+ function() { vtile.getData({compression:null}, function(err,out) {}); }, null,
"option 'compression' must be a string, either 'gzip', or 'none' (default)"
);
assert.throws(
- function() { vtile.getDataSync({level:null}); },
+ function() { vtile.getDataSync({level:null}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getData({level:null}, function(err,out) {}); },
+ function() { vtile.getData({level:null}, function(err,out) {}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getDataSync({level:99}); },
+ function() { vtile.getDataSync({level:99}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getData({level:99}, function(err,out) {}); },
+ function() { vtile.getData({level:99}, function(err,out) {}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getDataSync({level:-1}); },
+ function() { vtile.getDataSync({level:-1}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getData({level:-1}, function(err,out) {}); },
+ function() { vtile.getData({level:-1}, function(err,out) {}); }, null,
"option 'level' must be an integer between 0 (no compression) and 9 (best compression) inclusive"
);
assert.throws(
- function() { vtile.getDataSync({strategy:null}); },
+ function() { vtile.getDataSync({strategy:null}); }, null,
"option 'strategy' must be one of the following strings: FILTERED, HUFFMAN_ONLY, RLE, FIXED, DEFAULT"
);
assert.throws(
- function() { vtile.getData({strategy:null}, function(err,out) {}); },
+ function() { vtile.getData({strategy:null}, function(err,out) {}); }, null,
"option 'strategy' must be one of the following strings: FILTERED, HUFFMAN_ONLY, RLE, FIXED, DEFAULT"
);
assert.throws(
- function() { vtile.getDataSync({strategy:'FOO'}); },
+ function() { vtile.getDataSync({strategy:'FOO'}); }, null,
"option 'strategy' must be one of the following strings: FILTERED, HUFFMAN_ONLY, RLE, FIXED, DEFAULT"
);
assert.throws(
- function() { vtile.getData({strategy:'FOO'}, function(err,out) {}); },
+ function() { vtile.getData({strategy:'FOO'}, function(err,out) {}); }, null,
"option 'strategy' must be one of the following strings: FILTERED, HUFFMAN_ONLY, RLE, FIXED, DEFAULT"
);
});