From 313008fc312461a967e46d7d0e2250411c05db10 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 30 Nov 2010 14:48:03 +0000 Subject: [PATCH] Add lightweight std::exception catching main, dependent only upon and [SVN r66893] --- include/boost/detail/main.hpp | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 include/boost/detail/main.hpp diff --git a/include/boost/detail/main.hpp b/include/boost/detail/main.hpp new file mode 100644 index 0000000..d6196e9 --- /dev/null +++ b/include/boost/detail/main.hpp @@ -0,0 +1,36 @@ +// boost/detail/main.hpp -------------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +//--------------------------------------------------------------------------------------// +// // +// exception reporting main() that calls cpp_main() // +// // +//--------------------------------------------------------------------------------------// + +int cpp_main(int argc, char* argv[]); + +int main(int argc, char* argv[]) +{ + try + { + return cpp_main(argc, argv); + } + + catch (const std::exception& ex) + { + std::cout + << "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n" + << "\n****************************** std::exception *****************************\n" + << ex.what() + << "\n***************************************************************************\n" + << std::endl; + } + return 1; +}