From: curt Date: Tue, 24 Jul 2001 23:50:08 +0000 (+0000) Subject: - catch sg_exception instead of sg_io_exception X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ddbd85aa7b124a96ee6cbc0f4f608e6944724fd5;p=flightgear.git - catch sg_exception instead of sg_io_exception - use guiErrorMessage --- diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index fcc1ea930..c4f8d2c50 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -648,13 +648,8 @@ int readHud( istream &input ) try { readProperties(input, &root); - } catch (const sg_io_exception &e) { - string message = "Error reading HUD: "; - message += e.getMessage(); - message += "\n at "; - message += e.getLocation().asString(); - SG_LOG(SG_INPUT, SG_ALERT, message); - mkDialog(message.c_str()); + } catch (const sg_exception &e) { + guiErrorMessage("Error reading HUD: ", e); return 0; } @@ -687,13 +682,8 @@ int readHud( istream &input ) SGPropertyNode root2; try { readProperties(path.str(), &root2); - } catch (const sg_io_exception &e) { - string message = "Error reading HUD instrument: "; - message += e.getMessage(); - message += "\n at "; - message += e.getLocation().asString(); - SG_LOG(SG_INPUT, SG_ALERT, message); - mkDialog(message.c_str()); + } catch (const sg_exception &e) { + guiErrorMessage("Error reading HUD instrument: ", e); continue; } readInstrument(&root2); diff --git a/src/Cockpit/panel_io.cxx b/src/Cockpit/panel_io.cxx index 456d2d82f..5d86f1248 100644 --- a/src/Cockpit/panel_io.cxx +++ b/src/Cockpit/panel_io.cxx @@ -765,12 +765,8 @@ fgReadPanel (istream &input) try { readProperties(input, &root); - } catch (const sg_io_exception &e) { - string message = e.getMessage(); - message += "\n at "; - message += e.getLocation().asString(); - SG_LOG(SG_INPUT, SG_ALERT, message); - mkDialog(message.c_str()); + } catch (const sg_exception &e) { + guiErrorMessage("Error reading panel: ", e); return 0; } return readPanel(&root); @@ -792,12 +788,8 @@ fgReadPanel (const string &relative_path) try { readProperties(path.str(), &root); - } catch (const sg_io_exception &e) { - string message = e.getMessage(); - message += "\n at "; - message += e.getLocation().asString(); - SG_LOG(SG_INPUT, SG_ALERT, message); - mkDialog(message.c_str()); + } catch (const sg_exception &e) { + guiErrorMessage("Error reading panel: ", e); return 0; } return readPanel(&root); diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index de48e81e8..75d2725dc 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -212,13 +212,8 @@ do_preferences_load (const SGPropertyNode * arg, SGCommandState ** state) << props_path.str()); try { readProperties(props_path.str(), globals->get_props()); - } catch (const sg_io_exception &e) { - string message = "Error reading global preferences: "; - message += e.getMessage(); - message += "\n at "; - message += e.getLocation().asString(); - SG_LOG(SG_INPUT, SG_ALERT, message); - mkDialog(message.c_str()); + } catch (const sg_exception &e) { + guiErrorMessage("Error reading global preferences: ", e); return false; } SG_LOG(SG_INPUT, SG_INFO, "Successfully read global preferences.");