Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 8716b4a0d8550d184676ccbcff4630e34b763227..f2fffa2182a1be05d6dc4313c0c51f82c5bcff2a 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5431,17 +5431,19 @@ inline Local<String> NewString(Isolate* v8_isolate, |
String::NewStringType type, |
int length) { |
i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); |
+ ON_BAILOUT(isolate, location, return Local<String>()); |
LOG_API(isolate, env); |
if (length == 0) { |
return String::Empty(v8_isolate); |
} |
ENTER_V8(isolate); |
if (length == -1) length = StringLength(data); |
- // We do not expect this to fail. Change this if it does. |
- i::Handle<i::String> result = NewString( |
- isolate->factory(), |
- type, |
- i::Vector<const Char>(data, length)).ToHandleChecked(); |
+ EXCEPTION_PREAMBLE(isolate); |
+ i::Handle<i::String> result; |
+ has_pending_exception = |
+ !NewString(isolate->factory(), type, i::Vector<const Char>(data, length)) |
+ .ToHandle(&result); |
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |
return Utils::ToLocal(result); |
} |