Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-01-27 16:23:19 +0300
committerAnna Henningsen <anna@addaleax.net>2019-01-29 22:02:05 +0300
commit8e6667f4d5e29f67a3c423935ac852967d7cad78 (patch)
tree300686678aacce1af99980e2b0106883738e703c /src/node_i18n.cc
parent2c18d973a58fa782e0b2028221ef886596ee2050 (diff)
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>
Diffstat (limited to 'src/node_i18n.cc')
-rw-r--r--src/node_i18n.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
index edc7f56093a..e207ed96889 100644
--- a/src/node_i18n.cc
+++ b/src/node_i18n.cc
@@ -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);
}