Browse Source

better reporting on fatal exceptions

v0.7.4-release
Ryan 16 years ago
parent
commit
e78917b3b0
  1. 26
      node.cc

26
node.cc

@ -16,24 +16,6 @@ using namespace std;
static int exit_code = 0; static int exit_code = 0;
void
node_fatal_exception (TryCatch &try_catch)
{
HandleScope handle_scope;
Local<Message> message = try_catch.Message();
String::Utf8Value error(try_catch.Exception());
fprintf( stderr
, "Uncaught Exception. line %d '%s'\n\n"
, try_catch.Message()->GetLineNumber()
, *error
);
ev_unloop(node_loop(), EVUNLOOP_ALL);
exit_code = 1;
}
// Reads a file into a v8 string. // Reads a file into a v8 string.
static Handle<String> static Handle<String>
ReadFile (const string& name) ReadFile (const string& name)
@ -129,6 +111,14 @@ void ReportException(v8::TryCatch* try_catch) {
} }
} }
void
node_fatal_exception (TryCatch &try_catch)
{
ReportException(&try_catch);
ev_unloop(node_loop(), EVUNLOOP_ALL);
exit_code = 1;
}
// Executes a string within the current v8 context. // Executes a string within the current v8 context.
bool ExecuteString(v8::Handle<v8::String> source, bool ExecuteString(v8::Handle<v8::String> source,

Loading…
Cancel
Save