Skip to content

Commit 31501c8

Browse files
committed
tools: improve error handling in node_mksnapshot
1 parent 14c68e3 commit 31501c8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/snapshot/node_mksnapshot.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,16 @@ int BuildSnapshot(int argc, char* argv[]) {
6666
std::vector<std::string>(argv, argv + argc),
6767
node::ProcessInitializationFlags::kGeneratePredictableSnapshot);
6868

69+
if (result->exit_code() != 0) {
70+
for (const std::string& error : result->errors()) {
71+
std::cerr << error << "\n";
72+
}
73+
std::cerr << "node_mksnapshot failed with exit code " << result->exit_code()
74+
<< "\n";
75+
return static_cast<int>(result->exit_code());
76+
}
77+
6978
CHECK(!result->early_return());
70-
CHECK_EQ(result->exit_code(), 0);
7179

7280
std::string out_path;
7381
std::optional<std::string_view> builder_script_path = std::nullopt;

0 commit comments

Comments
 (0)