Permalink
Browse files

src: pass along errors from i18n converter instantiation

PR-URL: #25734
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information...
addaleax authored and targos committed Jan 27, 2019
1 parent deebf10 commit c0951062b9f3b3ccf30516421af16e16479336bc
Showing with 5 additions and 3 deletions.
  1. +5 −3 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);
}

0 comments on commit c095106

Please sign in to comment.