From 6dd850aa16cb3161e1046840c204dba093e9f683 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 8 Sep 2009 14:59:43 +0200 Subject: [PATCH] node.assert() was broken. --- src/node.cc | 6 ++++++ src/util.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 00554f8a4b..34f35bb5c3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -25,6 +25,8 @@ #include #include +#include + using namespace v8; using namespace node; @@ -382,10 +384,14 @@ main(int argc, char *argv[]) // to it's namespace node.EventEmitter in Load() bellow. EventEmitter::Initialize(process_template); + Debug::EnableAgent("node", 2222); + Persistent context = Context::New(NULL, process_template->InstanceTemplate()); Context::Scope context_scope(context); + + context->Global()->Set(String::NewSymbol("process"), context->Global()); Local node_obj = Load(argc, argv); diff --git a/src/util.js b/src/util.js index a06c5f7103..f1ad501c2f 100644 --- a/src/util.js +++ b/src/util.js @@ -19,8 +19,8 @@ node.inherits = function (ctor, superCtor) { ctor.prototype.constructor = ctor; }; -node.assert = function (x) { - if (!(x)) throw (msg || "assertion error"); +node.assert = function (x, msg) { + if (!(x)) throw new Error(msg || "assertion error"); }; // This is useful for dealing with raw encodings.