src: add IsFunction() assert to MakeCallback
authorBen Noordhuis <info@bnoordhuis.nl>
Sun, 2 Jun 2013 13:11:46 +0000 (15:11 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 19 Jul 2013 20:56:28 +0000 (22:56 +0200)
Helps catch bugs early on. Without it, V8 throws the fairly
unhelpful exception "TypeError: undefined is not a function" -
unhelpful because there is no stack trace.

src/node.cc

index dbe84d8..b4c3da7 100644 (file)
@@ -1058,6 +1058,7 @@ MakeCallback(const Handle<Object> object,
   HandleScope scope(node_isolate);
 
   Local<Function> callback = object->Get(symbol).As<Function>();
+  assert(callback->IsFunction());
 
   if (using_domains)
     return scope.Close(MakeDomainCallback(object, callback, argc, argv));