From 985ec4897537891ba7e6752956ab28930380d4bd 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 f13e53221eb018..5dab47f8208e43 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -222,7 +222,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 }