Skip to content

Instantly share code, notes, and snippets.

@xdenser
Created April 4, 2011 08:03
Show Gist options
  • Save xdenser/901273 to your computer and use it in GitHub Desktop.
Save xdenser/901273 to your computer and use it in GitHub Desktop.
console.log((new Error("test") instanceof Error));
var ctx = {log: function(msg){console.log(msg);}};
var vm = require('vm');
vm.runInNewContext('function errtest(err){log(err instanceof Error);}; errtest(new Error("test 2"));',ctx);
vm.runInNewContext('errtest(new Error("test 3"));',ctx);
// outputs:
// true
// true
// false - WTF ??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment