Fix ignored exception thrown from constructor.
This commit is contained in:
parent
be2934d9b5
commit
753d5675dd
2 changed files with 22 additions and 2 deletions
|
@ -156,7 +156,17 @@ class Constructor {
|
||||||
MATE_METHOD_RETURN_UNDEFINED();
|
MATE_METHOD_RETURN_UNDEFINED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Wrappable* object = internal::InvokeFactory(args, factory);
|
Wrappable* object;
|
||||||
|
{
|
||||||
|
// Don't continue if the constructor throws an exception.
|
||||||
|
v8::TryCatch try_catch;
|
||||||
|
object = internal::InvokeFactory(args, factory);
|
||||||
|
if (try_catch.HasCaught()) {
|
||||||
|
try_catch.ReThrow();
|
||||||
|
MATE_METHOD_RETURN_UNDEFINED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (object)
|
if (object)
|
||||||
object->Wrap(isolate, args->GetThis());
|
object->Wrap(isolate, args->GetThis());
|
||||||
else
|
else
|
||||||
|
|
|
@ -92,7 +92,17 @@ class Constructor {
|
||||||
MATE_METHOD_RETURN_UNDEFINED();
|
MATE_METHOD_RETURN_UNDEFINED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Wrappable* object = internal::InvokeFactory(args, factory);
|
Wrappable* object;
|
||||||
|
{
|
||||||
|
// Don't continue if the constructor throws an exception.
|
||||||
|
v8::TryCatch try_catch;
|
||||||
|
object = internal::InvokeFactory(args, factory);
|
||||||
|
if (try_catch.HasCaught()) {
|
||||||
|
try_catch.ReThrow();
|
||||||
|
MATE_METHOD_RETURN_UNDEFINED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (object)
|
if (object)
|
||||||
object->Wrap(isolate, args->GetThis());
|
object->Wrap(isolate, args->GetThis());
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue