From 834ae63d61ea4302a68a22cf8bd08e80c6d38ea4 Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 20 Jul 2021 11:56:36 +0800 Subject: [PATCH] src: print native module id on native module not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To help core contributors identify which file is missing from the build. PR-URL: https://github.com/nodejs/node/pull/39460 Refs: https://github.com/nodejs/node/issues/39408 Reviewed-By: Gireesh Punathil Reviewed-By: Zeyu Yang Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/node_native_module.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_native_module.cc b/src/node_native_module.cc index a5aa1edaf91143..c4fd96c75c1862 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -224,7 +224,10 @@ MaybeLocal NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate, isolate, contents.c_str(), v8::NewStringType::kNormal, contents.length()); #else const auto source_it = source_.find(id); - CHECK_NE(source_it, source_.end()); + if (UNLIKELY(source_it == source_.end())) { + fprintf(stderr, "Cannot find native builtin: \"%s\".\n", id); + ABORT(); + } return source_it->second.ToStringChecked(isolate); #endif // NODE_BUILTIN_MODULES_PATH }