![]() |
Home | Libraries | People | FAQ | More |
All class methods of Boost.Application that can generate an error has two version, one throws an exception of type boost::system::system_error, and another receive a boost::system::error_code variable 'ec' that would be set to the result of the operation, and no thrown an exception.
// ... int main(int argc, char *argv[]) { try { myapp app; application::context app_context; return application::launch<application::common>(app, app_context); } catch(boost::system::system_error& se) { // error std::cerr << se.what() << std::endl; return 1; } }
// ... int main(int argc, char *argv[]) { myapp app; application::context app_context; boost::system::error_code ec; int result = application::launch<application::common>(app, app_context, ec); if(ec) { std::cerr << "[E] " << ec.message() << " <" << ec.value() << "> " << std::cout; } return result; }