|
|
@ -318,15 +318,15 @@ const char* ToCString(const v8::String::Utf8Value& value) { |
|
|
|
return *value ? *value : "<str conversion failed>"; |
|
|
|
} |
|
|
|
|
|
|
|
static void ReportException(TryCatch *try_catch, bool show_line = false) { |
|
|
|
Handle<Message> message = try_catch->Message(); |
|
|
|
static void ReportException(TryCatch &try_catch, bool show_line = false) { |
|
|
|
Handle<Message> message = try_catch.Message(); |
|
|
|
if (message.IsEmpty()) { |
|
|
|
fprintf(stderr, "Error: (no message)\n"); |
|
|
|
fflush(stderr); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
Handle<Value> error = try_catch->Exception(); |
|
|
|
Handle<Value> error = try_catch.Exception(); |
|
|
|
Handle<String> stack; |
|
|
|
|
|
|
|
if (error->IsObject()) { |
|
|
@ -373,13 +373,13 @@ Local<Value> ExecuteString(Local<String> source, Local<Value> filename) { |
|
|
|
|
|
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
|
if (script.IsEmpty()) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
|
|
|
|
Local<Value> result = script->Run(); |
|
|
|
if (result.IsEmpty()) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
|
|
|
@ -824,7 +824,7 @@ Handle<Value> Compile(const Arguments& args) { |
|
|
|
Local<Script> script = Script::Compile(source, filename); |
|
|
|
if (try_catch.HasCaught()) { |
|
|
|
// Hack because I can't get a proper stacktrace on SyntaxError
|
|
|
|
ReportException(&try_catch, true); |
|
|
|
ReportException(try_catch, true); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
|
|
|
@ -850,7 +850,7 @@ void FatalException(TryCatch &try_catch) { |
|
|
|
|
|
|
|
// Check if uncaught_exception_counter indicates a recursion
|
|
|
|
if (uncaught_exception_counter > 0) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
|
|
|
@ -876,7 +876,7 @@ void FatalException(TryCatch &try_catch) { |
|
|
|
uint32_t length = listener_array->Length(); |
|
|
|
// Report and exit if process has no "uncaughtException" listener
|
|
|
|
if (length == 0) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
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[]) { |
|
|
|
HandleScope scope; |
|
|
|
|
|
|
@ -1043,7 +1039,7 @@ static void Load(int argc, char *argv[]) { |
|
|
|
String::New("node.js")); |
|
|
|
#ifndef NDEBUG |
|
|
|
if (try_catch.HasCaught()) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
exit(10); |
|
|
|
} |
|
|
|
#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
|
|
|
|
// 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 |
|
|
|
if (try_catch.HasCaught()) { |
|
|
|
ReportException(&try_catch); |
|
|
|
ReportException(try_catch); |
|
|
|
exit(11); |
|
|
|
} |
|
|
|
#endif |
|
|
|