Solve minor bug in bootstrap await refactor.
@@ -209,7 +209,14 @@ function node_loader_trampoline_test(obj) {
}
}
-function node_loader_trampoline_await(func, args, trampoline_ptr) {
+function node_loader_trampoline_await(trampoline) {
+ if (!trampoline) {
+ return function node_loader_trampoline_await_impl(func, args, trampoline_ptr) {
+ console.error('NodeJS await error, trampoline could not be found, await calls are disabled.');
+ };
+ }
+
+ return function node_loader_trampoline_await_impl(func, args, trampoline_ptr) {
if (typeof func !== 'function') {
throw new Error('Await only accepts a callable function func, not ' + typeof func);
}
@@ -230,6 +237,7 @@ function node_loader_trampoline_await(func, args, trampoline_ptr) {
x => console.error(`NodeJS await error: ${x && x.message ? x.message : util.inspect(x, false, null, true)}`),
)
);
+ };
}
function node_loader_trampoline_destroy() {
@@ -272,7 +280,7 @@ module.exports = ((impl, ptr) => {
'clear': node_loader_trampoline_clear,
'discover': node_loader_trampoline_discover,
'test': node_loader_trampoline_test,
- 'await': node_loader_trampoline_await,
+ 'await': node_loader_trampoline_await(trampoline),
'destroy': node_loader_trampoline_destroy,
});
} catch (ex) {
