From 396ceebf0dc021da2fa7cc38a7daf9e25bd1ede7 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 13 Nov 2019 10:24:10 +0100 Subject: [PATCH] "run with --log v8=debug" to see the stacktraces of logged error messages (#10373) --- lib/V8/v8-utils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index 98a08a2e71..8c8ad3010e 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -5113,6 +5113,15 @@ void TRI_LogV8Exception(v8::Isolate* isolate, v8::TryCatch* tryCatch) { LOG_TOPIC("cb0bd", ERR, arangodb::Logger::FIXME) << "!" << l; } + auto stacktraceV8 = + tryCatch->StackTrace(TRI_IGETC).FromMaybe(v8::Local()); + TRI_Utf8ValueNFC stacktrace(isolate, stacktraceV8); + + if (*stacktrace && stacktrace.length() > 0) { + LOG_TOPIC("cb0bf", DEBUG, arangodb::Logger::V8) << "!" << + "stacktrace: " + std::string(*stacktrace) + "\n"; + } + } }