From da9323040f9cbb073edcf081e9369d0a4755a9f5 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 14 May 2010 11:48:14 -0700 Subject: [PATCH] Simplify stack trace reporting using new V8 API --- src/node.cc | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/node.cc b/src/node.cc index d0e934def7..c9452a7132 100644 --- a/src/node.cc +++ b/src/node.cc @@ -958,15 +958,6 @@ const char* ToCString(const v8::String::Utf8Value& value) { static void ReportException(TryCatch &try_catch, bool show_line) { Handle message = try_catch.Message(); - Handle error = try_catch.Exception(); - Handle stack; - - if (error->IsObject()) { - Handle obj = Handle::Cast(error); - Handle raw_stack = obj->Get(String::New("stack")); - if (raw_stack->IsString()) stack = Handle::Cast(raw_stack); - } - if (show_line && !message.IsEmpty()) { // Print (filename):(line number): (message). String::Utf8Value filename(message->GetScriptResourceName()); @@ -1010,10 +1001,9 @@ static void ReportException(TryCatch &try_catch, bool show_line) { fprintf(stderr, "\n"); } - if (stack.IsEmpty()) { - message->PrintCurrentStackTrace(stderr); - } else { - String::Utf8Value trace(stack); + String::Utf8Value trace(try_catch.StackTrace()); + + if (trace.length() > 0) { fprintf(stderr, "%s\n", *trace); } fflush(stderr);