| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 075c95f commit fb356b3
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -303,17 +303,27 @@ std::string FormatCaughtException(Isolate* isolate, | |||
| 303 | 303 | Local<Value> err, | |
| 304 | 304 | Local<Message> message, | |
| 305 | 305 | bool add_source_line = true) { | |
| 306 | - std::string result; | ||
| 307 | 306 | node::Utf8Value reason(isolate, | |
| 308 | 307 | err->ToDetailString(context) | |
| 309 | 308 | .FromMaybe(Local<String>())); | |
| 309 | + std::string reason_str = reason.ToString(); | ||
| 310 | + return FormatErrorMessage( | ||
| 311 | + isolate, context, reason_str, message, add_source_line); | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + std::string FormatErrorMessage(Isolate* isolate, | ||
| 315 | + Local<Context> context, | ||
| 316 | + const std::string& reason, | ||
| 317 | + Local<Message> message, | ||
| 318 | + bool add_source_line) { | ||
| 319 | + std::string result; | ||
| 310 | 320 | if (add_source_line) { | |
| 311 | 321 | bool added_exception_line = false; | |
| 312 | 322 | std::string source = | |
| 313 | 323 | GetErrorSource(isolate, context, message, &added_exception_line); | |
| 314 | 324 | result = source + '\n'; | |
| 315 | 325 | } | |
| 316 | - result += reason.ToString() + '\n'; | ||
| 326 | + result += reason + '\n'; | ||
| 317 | 327 | ||
| 318 | 328 | Local<v8::StackTrace> stack = message->GetStackTrace(); | |
| 319 | 329 | if (!stack.IsEmpty()) result += FormatStackTrace(isolate, stack); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,7 +98,11 @@ void PrintCaughtException(v8::Isolate* isolate, | |||
| 98 | 98 | std::string FormatCaughtException(v8::Isolate* isolate, | |
| 99 | 99 | v8::Local<v8::Context> context, | |
| 100 | 100 | const v8::TryCatch& try_catch); | |
| 101 | - | ||
| 101 | + std::string FormatErrorMessage(v8::Isolate* isolate, | ||
| 102 | + v8::Local<v8::Context> context, | ||
| 103 | + const std::string& reason, | ||
| 104 | + v8::Local<v8::Message> message, | ||
| 105 | + bool add_source_line = true); | ||
| 102 | 106 | void ResetStdio(); // Safe to call more than once and from signal handlers. | |
| 103 | 107 | #ifdef __POSIX__ | |
| 104 | 108 | void SignalExit(int signal, siginfo_t* info, void* ucontext); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments