int main(int argc,char* argv[]) { std::ios_base::sync_with_stdio(false); // last chance to catch exceptions... // try { try_main(argc,argv); } catch (const blt_exception& e) { log_os << "FATAL_ERROR: " << pinfo.name() << " EXCEPTION: " << e.what() << "\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit(EXIT_FAILURE); } catch (const illumina::common::ExceptionData& e) { log_os << "FATAL_ERROR: " << pinfo.name() << " EXCEPTION: " << e.getContext() << ": " << e.getMessage() << "\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit (EXIT_FAILURE); } catch (const std::exception& e) { log_os << "FATAL_ERROR: EXCEPTION: " << e.what() << "\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit(EXIT_FAILURE); } catch (...) { log_os << "FATAL_ERROR: UNKNOWN EXCEPTION\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit(EXIT_FAILURE); } return EXIT_SUCCESS; }
// Thunk down to try_main, translate failure exceptions to exit codes. Other exceptions don't have a failure_code(), so just // let c++ do what it normally does. int main(int argc, char** argv ) { try { try_main(argc, argv); return 0; } catch( failure f ) { std::cerr << "Error " << f.failure_code() << ": " << f.what() << std::endl; return 1; } }
int main(int argc,char* argv[]){ std::ios_base::sync_with_stdio(false); // last chance to catch exceptions... // try{ try_main(argc,argv); } catch(const std::exception& e) { log_os << "FATAL:: EXCEPTION: " << e.what() << "\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit(EXIT_FAILURE); } catch(...) { log_os << "FATAL:: UNKNOWN EXCEPTION\n" << "...caught in main()\n"; dump_cl(argc,argv,log_os); exit(EXIT_FAILURE); } return EXIT_SUCCESS; }