]> git.mxchange.org Git - flightgear.git/commitdiff
Let exceptions fall through to main, and use cerr to report them (in
authordavid <david>
Thu, 4 Apr 2002 17:51:40 +0000 (17:51 +0000)
committerdavid <david>
Thu, 4 Apr 2002 17:51:40 +0000 (17:51 +0000)
case logging is disabled).  This way, when people specify a
non-existant aircraft or have an error in a custom XML file, they'll
get an error report, at least.

src/Main/fg_init.cxx
src/Main/main.cxx
src/Main/options.cxx

index 4dae0a6ab7293a8630827bcd68cd63b903a9bc7b..7a3e95a305566fc9bb584cabc65132562b327ef8 100644 (file)
@@ -231,14 +231,7 @@ bool fgInitConfig ( int argc, char **argv ) {
     SGPath props_path(globals->get_fg_root());
     props_path.append("preferences.xml");
     SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
-    try {
-      readProperties(props_path.str(), globals->get_props());
-    } catch (const sg_exception &e) {
-      string message = "Error reading global preferences: ";
-      message += e.getFormattedMessage();
-      SG_LOG(SG_INPUT, SG_ALERT, message);
-      exit(2);
-    }
+    readProperties(props_path.str(), globals->get_props());
     SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
 
     // Read the default aircraft config file.
index c8fc2d538ea951b7460d7ab606cabba98448cddd..fc16427a01439ac245559542f14c5e67c8687426 100644 (file)
 #endif
 
 #include <simgear/compiler.h>
+
+#include <iostream>
+SG_USING_STD(cerr);
+SG_USING_STD(endl);
+
 #include <simgear/misc/exception.hxx>
 #include <simgear/ephemeris/ephemeris.hxx>
 #include <simgear/route/route.hxx>
@@ -1598,9 +1603,11 @@ int main ( int argc, char **argv ) {
     try {
         mainLoop(argc, argv);
     } catch (sg_throwable &t) {
-        SG_LOG(SG_GENERAL, SG_ALERT,
-               "Fatal error: " << t.getFormattedMessage()
-               << "\n (received from " << t.getOrigin() << ')');
+                               // We must use cerr rather than
+                               // logging, since logging may be
+                               // disabled.
+        cerr << "Fatal error: " << t.getFormattedMessage()
+            << "\n (received from " << t.getOrigin() << ')' << endl;
         exit(1);
     }
 
index 69cb9056f63e56d32039fd743cf2d65a7e29c163..e6257c4a53290838512db58f0a968ce9e4ac066b 100644 (file)
@@ -942,14 +942,7 @@ parse_option (const string& arg)
         apath.concat( "-set.xml" );
        SG_LOG(SG_INPUT, SG_INFO, "Reading aircraft: " << arg.substr(11)
            << " from " << apath.str());
-        try {
-            readProperties( apath.str(), globals->get_props() );
-        } catch (const sg_exception &e) {
-            string message = "Error loading aircraft file: ";
-            message += e.getFormattedMessage();
-            SG_LOG(SG_INPUT, SG_ALERT, message);
-            exit(2);
-        }
+       readProperties( apath.str(), globals->get_props() );
     } else {
        SG_LOG( SG_GENERAL, SG_ALERT, "Unknown option '" << arg << "'" );
        return FG_OPTIONS_ERROR;