0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

src: pass along errors from i18n converter instantiation

PR-URL: https://github.com/nodejs/node/pull/25734
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
Anna Henningsen 2019-01-27 14:23:19 +01:00
parent 2c18d973a5
commit 8e6667f4d5
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -171,6 +171,11 @@ class ConverterObject : public BaseObject, Converter {
Environment* env = Environment::GetCurrent(args);
HandleScope scope(env->isolate());
Local<ObjectTemplate> t = ObjectTemplate::New(env->isolate());
t->SetInternalFieldCount(1);
Local<Object> obj;
if (!t->NewInstance(env->context()).ToLocal(&obj)) return;
CHECK_GE(args.Length(), 2);
Utf8Value label(env->isolate(), args[0]);
int flags = args[1]->Uint32Value(env->context()).ToChecked();
@ -190,9 +195,6 @@ class ConverterObject : public BaseObject, Converter {
nullptr, nullptr, nullptr, &status);
}
Local<ObjectTemplate> t = ObjectTemplate::New(env->isolate());
t->SetInternalFieldCount(1);
Local<Object> obj = t->NewInstance(env->context()).ToLocalChecked();
new ConverterObject(env, obj, conv, ignoreBOM);
args.GetReturnValue().Set(obj);
}