Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 132891e2b8a694919c0643118dea5fd8ef82b403..2ef7162878713a6c0385c4c5c0ed6a190facb87b 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -587,24 +587,24 @@ Handle<String> Shell::ReadFromStdin(Isolate* isolate) { |
void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ Isolate* isolate = args.GetIsolate(); |
for (int i = 0; i < args.Length(); i++) { |
- HandleScope handle_scope(args.GetIsolate()); |
+ HandleScope handle_scope(isolate); |
String::Utf8Value file(args[i]); |
if (*file == NULL) { |
- Throw(args.GetIsolate(), "Error loading file"); |
+ Throw(isolate, "Error loading file"); |
return; |
} |
- Handle<String> source = ReadFile(args.GetIsolate(), *file); |
+ Handle<String> source = ReadFile(isolate, *file); |
if (source.IsEmpty()) { |
- Throw(args.GetIsolate(), "Error loading file"); |
+ Throw(isolate, "Error loading file"); |
return; |
} |
- if (!ExecuteString(args.GetIsolate(), |
- source, |
- String::NewFromUtf8(args.GetIsolate(), *file), |
- false, |
- true)) { |
- Throw(args.GetIsolate(), "Error executing file"); |
+ if (!ExecuteString(isolate, source, String::NewFromUtf8(isolate, *file), |
+ false, true)) { |
+ // Exception is already reported, so clear it before throwing another one. |
+ reinterpret_cast<i::Isolate*>(isolate)->clear_pending_exception(); |
Yang
2014/12/23 22:16:09
Can we assert that there is indeed a pending excep
|
+ Throw(isolate, "Error executing file"); |
return; |
} |
} |