| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d8af9d8 commit 78be1e4
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,53 +79,6 @@ const char* ToCString(const v8::String::Utf8Value& value) { | |||
| 79 | 79 | return *value ? *value : "<str conversion failed>"; | |
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | - | ||
| 83 | - static void ReportException(TryCatch &try_catch, bool show_line = false, bool show_rest = true) { | ||
| 84 | - Handle<Message> message = try_catch.Message(); | ||
| 85 | - | ||
| 86 | - Handle<Value> error = try_catch.Exception(); | ||
| 87 | - Handle<String> stack; | ||
| 88 | - | ||
| 89 | - if (error->IsObject()) { | ||
| 90 | - Handle<Object> obj = Handle<Object>::Cast(error); | ||
| 91 | - Handle<Value> raw_stack = obj->Get(String::New("stack")); | ||
| 92 | - if (raw_stack->IsString()) stack = Handle<String>::Cast(raw_stack); | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - if (show_line && !message.IsEmpty()) { | ||
| 96 | - // Print (filename):(line number): (message). | ||
| 97 | - String::Utf8Value filename(message->GetScriptResourceName()); | ||
| 98 | - const char* filename_string = ToCString(filename); | ||
| 99 | - int linenum = message->GetLineNumber(); | ||
| 100 | - fprintf(stderr, "%s:%i\n", filename_string, linenum); | ||
| 101 | - // Print line of source code. | ||
| 102 | - String::Utf8Value sourceline(message->GetSourceLine()); | ||
| 103 | - const char* sourceline_string = ToCString(sourceline); | ||
| 104 | - fprintf(stderr, "%s\n", sourceline_string); | ||
| 105 | - // Print wavy underline (GetUnderline is deprecated). | ||
| 106 | - int start = message->GetStartColumn(); | ||
| 107 | - for (int i = 0; i < start; i++) { | ||
| 108 | - fprintf(stderr, " "); | ||
| 109 | - } | ||
| 110 | - int end = message->GetEndColumn(); | ||
| 111 | - for (int i = start; i < end; i++) { | ||
| 112 | - fprintf(stderr, "^"); | ||
| 113 | - } | ||
| 114 | - fprintf(stderr, "\n"); | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - if (show_rest) { | ||
| 118 | - if (stack.IsEmpty()) { | ||
| 119 | - message->PrintCurrentStackTrace(stderr); | ||
| 120 | - } else { | ||
| 121 | - String::Utf8Value trace(stack); | ||
| 122 | - fprintf(stderr, "%s\n", *trace); | ||
| 123 | - } | ||
| 124 | - } | ||
| 125 | - fflush(stderr); | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - | ||
| 129 | 82 | template <node::Script::EvalInputFlags iFlag, | |
| 130 | 83 | node::Script::EvalContextFlags cFlag, | |
| 131 | 84 | node::Script::EvalOutputFlags oFlag> | |
@@ -181,7 +134,6 @@ Handle<Value> node::Script::EvalMachine(const Arguments& args) { | |||
| 181 | 134 | script = oFlag == returnResult ? v8::Script::Compile(code, filename) : v8::Script::New(code, filename); | |
| 182 | 135 | if (script.IsEmpty()) { | |
| 183 | 136 | // Hack because I can't get a proper stacktrace on SyntaxError | |
| 184 | - ReportException(try_catch, true, false); | ||
| 185 | 137 | result = ThrowException(try_catch.Exception()); | |
| 186 | 138 | } | |
| 187 | 139 | } else { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments