Revision: 25273
Author:   [email protected]
Date:     Tue Nov 11 21:44:38 2014 UTC
Log:      Rename v8::Exception::GetMessage to CreateMessage.

This is to avoid renaming to GetMessageW/GetMessageA on Windows.

API=v8::Exception::CreateMessage
[email protected], loislo
LOG=Y

Review URL: https://codereview.chromium.org/711353002
https://code.google.com/p/v8/source/detail?r=25273

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Fri Nov  7 16:29:13 2014 UTC
+++ /branches/bleeding_edge/include/v8.h        Tue Nov 11 21:44:38 2014 UTC
@@ -4188,9 +4188,17 @@
   static Local<Value> TypeError(Handle<String> message);
   static Local<Value> Error(Handle<String> message);

-  static Local<Message> GetMessage(Handle<Value> exception);
+  /**
+   * Creates an error message for the given exception.
+ * Will try to reconstruct the original stack trace from the exception value,
+   * or capture the current stack trace if not available.
+   */
+  static Local<Message> CreateMessage(Handle<Value> exception);

-  // DEPRECATED. Use GetMessage()->GetStackTrace()
+  /**
+ * Returns the original stack trace that was captured at the creation time
+   * of a given exception, or an empty handle if not available.
+   */
   static Local<StackTrace> GetStackTrace(Handle<Value> exception);
 };

@@ -4252,7 +4260,7 @@
   V8_INLINE PromiseRejectEvent GetEvent() const { return event_; }
   V8_INLINE Handle<Value> GetValue() const { return value_; }

-  // DEPRECATED. Use v8::Exception::GetMessage(GetValue())->GetStackTrace()
+ // DEPRECATED. Use v8::Exception::CreateMessage(GetValue())->GetStackTrace() V8_INLINE Handle<StackTrace> GetStackTrace() const { return stack_trace_; }

  private:
=======================================
--- /branches/bleeding_edge/src/api.cc  Fri Nov  7 16:03:11 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Tue Nov 11 21:44:38 2014 UTC
@@ -6986,7 +6986,7 @@
 #undef DEFINE_ERROR


-Local<Message> Exception::GetMessage(Handle<Value> exception) {
+Local<Message> Exception::CreateMessage(Handle<Value> exception) {
   i::Handle<i::Object> obj = Utils::OpenHandle(*exception);
   if (!obj->IsHeapObject()) return Local<Message>();
   i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Mon Nov 10 18:03:50 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Tue Nov 11 21:44:38 2014 UTC
@@ -8635,7 +8635,7 @@
 }


-THREADED_TEST(ExceptionGetMessage) {
+THREADED_TEST(ExceptionCreateMessage) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
   v8::Handle<String> foo_str = v8_str("foo");
@@ -8660,7 +8660,7 @@
   CHECK(error->IsObject());
   CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str));

-  v8::Handle<v8::Message> message = v8::Exception::GetMessage(error);
+  v8::Handle<v8::Message> message = v8::Exception::CreateMessage(error);
   CHECK(!message.IsEmpty());
   CHECK_EQ(2, message->GetLineNumber());
   CHECK_EQ(2, message->GetStartColumn());
@@ -8669,6 +8669,10 @@
   CHECK(!stackTrace.IsEmpty());
   CHECK_EQ(2, stackTrace->GetFrameCount());

+  stackTrace = v8::Exception::GetStackTrace(error);
+  CHECK(!stackTrace.IsEmpty());
+  CHECK_EQ(2, stackTrace->GetFrameCount());
+
   v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);

// Now check message location when SetCaptureStackTraceForUncaughtExceptions
@@ -8686,7 +8690,7 @@
   CHECK(error->IsObject());
   CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str));

-  message = v8::Exception::GetMessage(error);
+  message = v8::Exception::CreateMessage(error);
   CHECK(!message.IsEmpty());
   CHECK_EQ(2, message->GetLineNumber());
   CHECK_EQ(9, message->GetStartColumn());
@@ -8694,6 +8698,7 @@
   // Should be empty stack trace.
   stackTrace = message->GetStackTrace();
   CHECK(stackTrace.IsEmpty());
+  CHECK(v8::Exception::GetStackTrace(error).IsEmpty());
 }


@@ -18022,7 +18027,7 @@
     CcTest::global()->Set(v8_str("rejected"), message.GetPromise());
     CcTest::global()->Set(v8_str("value"), message.GetValue());
     v8::Handle<v8::StackTrace> stack_trace =
-        v8::Exception::GetMessage(message.GetValue())->GetStackTrace();
+        v8::Exception::CreateMessage(message.GetValue())->GetStackTrace();
     if (!stack_trace.IsEmpty()) {
       promise_reject_frame_count = stack_trace->GetFrameCount();
       if (promise_reject_frame_count > 0) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to