| Index: src/api.cc
|
| ===================================================================
|
| --- src/api.cc (revision 615)
|
| +++ src/api.cc (working copy)
|
| @@ -230,7 +230,13 @@
|
|
|
| v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
|
| if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>();
|
| - i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
|
| + // If we're passed an empty handle, we throw an undefined exception
|
| + // to deal more gracefully with out of memory situations.
|
| + if (value.IsEmpty()) {
|
| + i::Top::ScheduleThrow(i::Heap::undefined_value());
|
| + } else {
|
| + i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
|
| + }
|
| return v8::Undefined();
|
| }
|
|
|
|
|