From 784adc86bad5d6f6b23107add027b4c1620a3698 Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 20 Jul 2021 11:56:36 +0800 Subject: [PATCH 1/3] src: print native module id on native module not found --- 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..70fed1c13dd288 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\"", id); + ABORT(); + } return source_it->second.ToStringChecked(isolate); #endif // NODE_BUILTIN_MODULES_PATH } From edc7eb6547c3a17da27f93b9e974068d8ca7b54b Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 20 Jul 2021 12:14:20 +0800 Subject: [PATCH 2/3] fixup! src: print native module id on native module not found --- src/node_native_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_native_module.cc b/src/node_native_module.cc index 70fed1c13dd288..348262e9c1264f 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -225,7 +225,7 @@ MaybeLocal NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate, #else const auto source_it = source_.find(id); if (UNLIKELY(source_it == source_.end())) { - fprintf(stderr, "Cannot find native builtin. \"%s\"", id); + fprintf(stderr, "Cannot find native builtin. \"%s\"\n", id); ABORT(); } return source_it->second.ToStringChecked(isolate); From ae0e8aa460d4a7cf2e9f6b077a31ecfc93e36126 Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 20 Jul 2021 12:18:50 +0800 Subject: [PATCH 3/3] fixup! src: print native module id on native module not found --- src/node_native_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_native_module.cc b/src/node_native_module.cc index 348262e9c1264f..c4fd96c75c1862 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -225,7 +225,7 @@ MaybeLocal NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate, #else const auto source_it = source_.find(id); if (UNLIKELY(source_it == source_.end())) { - fprintf(stderr, "Cannot find native builtin. \"%s\"\n", id); + fprintf(stderr, "Cannot find native builtin: \"%s\".\n", id); ABORT(); } return source_it->second.ToStringChecked(isolate);