Ejemplo n.º 1
0
std::string sourceLine(
  v8::Isolate *isolate,
  const v8::Local<v8::Message> &message)
{
  std::string source_line_str = "";

  v8::MaybeLocal<v8::String> source_line_maybe = message->GetSourceLine(
    isolate->GetCurrentContext());

  if (!source_line_maybe.IsEmpty())
  {
    v8::Local<v8::Value> source_line =
      source_line_maybe.ToLocalChecked();

    if (source_line->IsString())
      source_line_str = v8cffi_utils::toCString(
        v8::String::Utf8Value(source_line));
  }

  return source_line_str;
}