Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
main_wrapper.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5namespace joedb
6{
7 /// Process command-line arguments and catch exceptions from main
8 ///
9 /// This function is particularly necessary in Windows, because no
10 /// exception information is printed when main throws.
11 ///
12 /// @ingroup ui
14 (
15 int (*main)(Arguments &), int argc, char **argv
16 )
17 {
18 try
19 {
20 Arguments arguments(argc, argv);
21 return main(arguments);
22 }
23 catch (const std::exception &e)
24 {
25 std::cerr << "Exception caught: " << e.what() << '\n';
26 return 1;
27 }
28 }
29}
Class for conveniently parsing command-line arguments.
Definition Arguments.h:19
int main()
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.