Skip to content

Commit a06db2d

Browse files
committed
better todo for JSON parse failure
1 parent 2d6d4e6 commit a06db2d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/module_wrap.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,11 @@ const Environment::PackageConfig& GetPackageConfig(Environment* env,
528528
Local<Value> pkg_json_v;
529529
Local<Object> pkg_json;
530530

531+
// TODO: Invalid package.json MUST THROW the resolve
532+
// currently this will just silently ignore
531533
if (!JSON::Parse(env->context(), src).ToLocal(&pkg_json_v) ||
532534
!pkg_json_v->ToObject(env->context()).ToLocal(&pkg_json))
533-
return kEmptyPackage; // Exception pending.
535+
return kEmptyPackage;
534536

535537
Local<Value> pkg_main;
536538
bool has_main = false;

0 commit comments

Comments
 (0)