Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 9eccc7e4fe4ed6fd0786c0bbeb62a06ffb277498..cc91daa692f1cd00e17af640468915f45eeb74a5 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -301,10 +301,26 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args, |
} else { |
Local<Number> number = args[0]->ToNumber(); |
if (number.IsEmpty() || !number->IsNumber()) { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ if (isolate->try_catch_handler()->HasCaught()) { |
+ return isolate->try_catch_handler()->Exception(); |
+ } |
return ThrowException(String::New("Array length must be a number.")); |
} |
- int32_t raw_length = number->ToInt32()->Int32Value(); |
+ Local<Int32> int32 = number->ToInt32(); |
+ if (int32.IsEmpty()) { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ if (isolate->try_catch_handler()->HasCaught()) { |
+ return isolate->try_catch_handler()->Exception(); |
+ } |
+ return ThrowException(String::New("Array length must be a number.")); |
Rico
2011/12/13 11:28:39
we already established that length is a number, so
Jakob Kummerow
2011/12/13 13:04:37
On second thought, no, we can't. Done.
|
+ } |
+ int32_t raw_length = int32->Int32Value(); |
if (raw_length < 0) { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ if (isolate->try_catch_handler()->HasCaught()) { |
+ return isolate->try_catch_handler()->Exception(); |
+ } |
return ThrowException(String::New("Array length must not be negative.")); |
} |
if (raw_length > static_cast<int32_t>(kMaxLength)) { |