opmrst_inspect: avoid exceptions escaping main()

This commit is contained in:
Arne Morten Kvarving committed 2026-05-28 10:05:22 +02:00
1 parent 2cb6096169
commit 6fd8f8126a
1 file changed
+10 -1
+10 -1
View File
@@ -29,11 +29,12 @@
#include <fmt/format.h>
#include <array>
#include <exception>
#include <iostream>
#include <string>
int main(int argc, char** argv)
{
try {
if (argc < 2) {
std::cerr << "Need one parameter, the .OPMRST file to inspect\n";
return 1;
@@ -84,3 +85,11 @@ int main(int argc, char** argv)
return 0;
}
catch (const std::exception& e) {
std::cerr << "Exception thrown " << e.what() << std::endl;
return 2;
}
catch (...) {
std::cerr << "Unknown exception thrown" << std::endl;
return 2;
}