|
@ -958,15 +958,6 @@ const char* ToCString(const v8::String::Utf8Value& value) { |
|
|
static void ReportException(TryCatch &try_catch, bool show_line) { |
|
|
static void ReportException(TryCatch &try_catch, bool show_line) { |
|
|
Handle<Message> message = try_catch.Message(); |
|
|
Handle<Message> message = try_catch.Message(); |
|
|
|
|
|
|
|
|
Handle<Value> error = try_catch.Exception(); |
|
|
|
|
|
Handle<String> stack; |
|
|
|
|
|
|
|
|
|
|
|
if (error->IsObject()) { |
|
|
|
|
|
Handle<Object> obj = Handle<Object>::Cast(error); |
|
|
|
|
|
Handle<Value> raw_stack = obj->Get(String::New("stack")); |
|
|
|
|
|
if (raw_stack->IsString()) stack = Handle<String>::Cast(raw_stack); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (show_line && !message.IsEmpty()) { |
|
|
if (show_line && !message.IsEmpty()) { |
|
|
// Print (filename):(line number): (message).
|
|
|
// Print (filename):(line number): (message).
|
|
|
String::Utf8Value filename(message->GetScriptResourceName()); |
|
|
String::Utf8Value filename(message->GetScriptResourceName()); |
|
@ -1010,10 +1001,9 @@ static void ReportException(TryCatch &try_catch, bool show_line) { |
|
|
fprintf(stderr, "\n"); |
|
|
fprintf(stderr, "\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (stack.IsEmpty()) { |
|
|
String::Utf8Value trace(try_catch.StackTrace()); |
|
|
message->PrintCurrentStackTrace(stderr); |
|
|
|
|
|
} else { |
|
|
if (trace.length() > 0) { |
|
|
String::Utf8Value trace(stack); |
|
|
|
|
|
fprintf(stderr, "%s\n", *trace); |
|
|
fprintf(stderr, "%s\n", *trace); |
|
|
} |
|
|
} |
|
|
fflush(stderr); |
|
|
fflush(stderr); |
|
|