bench: Fail gracefully if function_call binding fails
authorisaacs <i@izs.me>
Tue, 12 Feb 2013 08:13:18 +0000 (00:13 -0800)
committerisaacs <i@izs.me>
Tue, 19 Feb 2013 22:14:38 +0000 (14:14 -0800)
benchmark/misc/function_call/index.js

index ac05478..fc8542a 100644 (file)
@@ -6,7 +6,16 @@
 var assert = require('assert');
 var common = require('../../common.js');
 
-var binding = require('./build/Release/binding');
+// this fails when we try to open with a different version of node,
+// which is quite common for benchmarks.  so in that case, just
+// abort quietly.
+
+try {
+  var binding = require('./build/Release/binding');
+} catch (er) {
+  console.error('misc/function_call.js Binding failed to load');
+  process.exit(0);
+}
 var cxx = binding.hello;
 
 var c = 0;