17 #include <glog/logging.h> 33 v8::HandleScope handle_scope(isolate);
34 for (
int i = 0; i < stack->GetFrameCount(); ++i) {
35 const v8::Local<v8::StackFrame>
frame = stack->GetFrame(isolate, i);
36 const v8::String::Utf8Value
name(isolate, frame->GetScriptName());
37 const v8::String::Utf8Value func(isolate, frame->GetFunctionName());
38 const int row = frame->GetLineNumber();
39 const int col = frame->GetColumn();
41 std::string func_or_main = func.length() ? *func :
"<anonymous>";
42 LOG(ERROR) <<
" at " << func_or_main <<
" (" << *
name <<
":" << row <<
":" 49 if (exception.IsEmpty())
54 v8::String::Utf8Value err_str(isolate, exception);
56 LOG(ERROR) <<
"Uncaught (in promise): " << *err_str;
58 LOG(ERROR) <<
"Uncaught:" << *err_str;
60 v8::HandleScope handle_scope(isolate);
61 v8::Local<v8::StackTrace> stack = v8::Exception::GetStackTrace(exception);
62 if (!stack.IsEmpty()) {
std::shared_ptr< shaka::media::DecodedFrame > frame
static JsEngine * Instance()
void OnUncaughtException(JSValueRef exception, bool in_promise)
void PrintStackTrace(const v8::Local< v8::StackTrace > &stack)
v8::Isolate * GetIsolate()