Skip to content

Commit 6c43cff

Browse files
committed
catch more types of errors
1 parent 577d27f commit 6c43cff

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

voxec_main.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,27 @@ int main(int argc, char** argv) {
108108
return 1;
109109
}
110110

111+
boost::optional<std::string> error;
112+
111113
try {
112114
run(tree, d, threads.get_value_or(1), chunk.get_value_or(128), with_mesh, quiet);
113-
return 0;
114115
} catch (const std::runtime_error& e) {
116+
error = std::string(e.what());
117+
} catch (const Standard_Failure& e) {
118+
if (e.GetMessageString()) {
119+
error = std::string(e.GetMessageString());
120+
} else {
121+
error.emplace();
122+
}
123+
} catch (...) {
124+
error.emplace();
125+
}
126+
127+
if (error) {
115128
json_logger::message(json_logger::LOG_FATAL, "encountered {error} while running voxelfile", {
116-
{"error", {{"message", std::string(e.what())}}}
129+
{"error", {{"message", *error}}}
117130
});
118-
return 1;
119131
}
132+
133+
return error ? 1 : 0;
120134
}

0 commit comments

Comments
 (0)