|
@ -318,15 +318,15 @@ const char* ToCString(const v8::String::Utf8Value& value) { |
|
|
return *value ? *value : "<str conversion failed>"; |
|
|
return *value ? *value : "<str conversion failed>"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void ReportException(TryCatch *try_catch, bool show_line = false) { |
|
|
static void ReportException(TryCatch &try_catch, bool show_line = false) { |
|
|
Handle<Message> message = try_catch->Message(); |
|
|
Handle<Message> message = try_catch.Message(); |
|
|
if (message.IsEmpty()) { |
|
|
if (message.IsEmpty()) { |
|
|
fprintf(stderr, "Error: (no message)\n"); |
|
|
fprintf(stderr, "Error: (no message)\n"); |
|
|
fflush(stderr); |
|
|
fflush(stderr); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Handle<Value> error = try_catch->Exception(); |
|
|
Handle<Value> error = try_catch.Exception(); |
|
|
Handle<String> stack; |
|
|
Handle<String> stack; |
|
|
|
|
|
|
|
|
if (error->IsObject()) { |
|
|
if (error->IsObject()) { |
|
@ -373,13 +373,13 @@ Local<Value> ExecuteString(Local<String> source, Local<Value> filename) { |
|
|
|
|
|
|
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
if (script.IsEmpty()) { |
|
|
if (script.IsEmpty()) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Local<Value> result = script->Run(); |
|
|
Local<Value> result = script->Run(); |
|
|
if (result.IsEmpty()) { |
|
|
if (result.IsEmpty()) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -824,7 +824,7 @@ Handle<Value> Compile(const Arguments& args) { |
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
if (try_catch.HasCaught()) { |
|
|
if (try_catch.HasCaught()) { |
|
|
// Hack because I can't get a proper stacktrace on SyntaxError
|
|
|
// Hack because I can't get a proper stacktrace on SyntaxError
|
|
|
ReportException(&try_catch, true); |
|
|
ReportException(try_catch, true); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -850,7 +850,7 @@ void FatalException(TryCatch &try_catch) { |
|
|
|
|
|
|
|
|
// Check if uncaught_exception_counter indicates a recursion
|
|
|
// Check if uncaught_exception_counter indicates a recursion
|
|
|
if (uncaught_exception_counter > 0) { |
|
|
if (uncaught_exception_counter > 0) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -876,7 +876,7 @@ void FatalException(TryCatch &try_catch) { |
|
|
uint32_t length = listener_array->Length(); |
|
|
uint32_t length = listener_array->Length(); |
|
|
// Report and exit if process has no "uncaughtException" listener
|
|
|
// Report and exit if process has no "uncaughtException" listener
|
|
|
if (length == 0) { |
|
|
if (length == 0) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -915,10 +915,6 @@ static void DebugMessageDispatch(void) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ExecuteNativeJS(const char *filename, const char *data) { |
|
|
|
|
|
HandleScope scope; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void Load(int argc, char *argv[]) { |
|
|
static void Load(int argc, char *argv[]) { |
|
|
HandleScope scope; |
|
|
HandleScope scope; |
|
|
|
|
|
|
|
@ -1043,7 +1039,7 @@ static void Load(int argc, char *argv[]) { |
|
|
String::New("node.js")); |
|
|
String::New("node.js")); |
|
|
#ifndef NDEBUG |
|
|
#ifndef NDEBUG |
|
|
if (try_catch.HasCaught()) { |
|
|
if (try_catch.HasCaught()) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(10); |
|
|
exit(10); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
@ -1058,11 +1054,12 @@ static void Load(int argc, char *argv[]) { |
|
|
// who do not like how 'src/node.js' setups the module system but do like
|
|
|
// who do not like how 'src/node.js' setups the module system but do like
|
|
|
// Node's I/O bindings may want to replace 'f' with their own function.
|
|
|
// Node's I/O bindings may want to replace 'f' with their own function.
|
|
|
|
|
|
|
|
|
f->Call(global, 1, &Local<Value>::New(process)); |
|
|
Local<Value> args[1] = { Local<Value>::New(process) }; |
|
|
|
|
|
f->Call(global, 1, args); |
|
|
|
|
|
|
|
|
#ifndef NDEBUG |
|
|
#ifndef NDEBUG |
|
|
if (try_catch.HasCaught()) { |
|
|
if (try_catch.HasCaught()) { |
|
|
ReportException(&try_catch); |
|
|
ReportException(try_catch); |
|
|
exit(11); |
|
|
exit(11); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|