From 4141c6f8bb42b3491502f5e6b82595367da9fb69 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 19 Jul 2001 04:54:53 +0000 Subject: [PATCH] - moved main to mainLoop, and added top-level main to catch any missed exceptions; we'll make it smarter later --- src/Main/main.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 6f3c3bb39..71531a268 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -26,6 +26,7 @@ #endif #include +#include #ifdef SG_MATH_EXCEPTION_CLASH # include @@ -1426,8 +1427,8 @@ int fgGlutInitEvents( void ) { } -// Main ... -int main( int argc, char **argv ) { +// Main loop +int mainLoop( int argc, char **argv ) { #if defined( macintosh ) freopen ("stdout.txt", "w", stdout ); @@ -1757,6 +1758,26 @@ int main( int argc, char **argv ) { // $$$ end - added VS Renganathan, 15 Oct 2K // - added Venky , 12 Nov 2K +// Main entry point; catch any exceptions that have made it this far. +int main ( int argc, char **argv ) { + // FIXME: add other, more specific + // exceptions. + try { + mainLoop(argc, argv); + } catch (sg_io_exception e1) { + SG_LOG(SG_GENERAL, SG_ALERT, + "Fatal error " << e1.getMessage() + << " received from " << e1.getOrigin() + << "\n at " << e1.getLocation().asString()); + } catch (sg_exception e) { + SG_LOG(SG_GENERAL, SG_ALERT, + "Fatal error " << e.getMessage() + << " received from " << e.getOrigin()); + exit(1); + } +} + + void fgLoadDCS(void) { ssgEntity *ship_obj = NULL; -- 2.39.5