Commit ef2f1d64c8465352ac615d1d6c053fedc53382b6
Catch all exceptions in main()
It's necessary to do RAII cleanup and can also be more user-friendly.
Author: xaizek
Author date (UTC): 2024-01-20 14:23
Committer name: xaizek
Committer date (UTC): 2024-01-20 14:23
Parent(s): 2ac21edc8f6b643a9ada582d4abf41adf66d0e7e
Signing key: 99DC5E4DB05F6BE2
Tree: c652c82fdc933c9e1500784f95862c5906ad6267
File src/main.cpp changed (mode: 100644) (index 9931b03..8b4c5e9) |
... |
... |
main(int argc, char *argv[]) |
35 |
35 |
} catch (const std::exception &e) { |
} catch (const std::exception &e) { |
36 |
36 |
std::cerr << "Error: " << e.what() << '\n'; |
std::cerr << "Error: " << e.what() << '\n'; |
37 |
37 |
return EXIT_FAILURE; |
return EXIT_FAILURE; |
|
38 |
|
} catch (...) { |
|
39 |
|
std::cerr << "Unexpected exception\n"; |
|
40 |
|
// Rethrow it to see its message. |
|
41 |
|
throw; |
38 |
42 |
} |
} |
39 |
43 |
} |
} |