Random exception changes (voodoo debugging for certain broke-ass gentoo systems).

git-svn-id: http://svn.drobilla.net/lad/patchage@386 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
drobilla 2007-03-31 20:41:51 +00:00
parent 7b8e1a7fae
commit 31ba03b9c6
3 changed files with 16 additions and 13 deletions

View File

@ -123,12 +123,7 @@ Patchage::Patchage(int argc, char** argv)
fs.close();
}
try {
xml = Gnome::Glade::Xml::create(glade_filename);
} catch(const Gnome::Glade::XmlError& ex) {
std::cerr << ex.what() << std::endl;
throw;
}
xml = Gnome::Glade::Xml::create(glade_filename);
xml->get_widget("patchage_win", _main_window);
xml->get_widget_derived("jack_settings_win", _jack_settings_dialog);

View File

@ -16,6 +16,7 @@
*/
#include "StateManager.h"
#include <stdexcept>
#include <stdlib.h>
#include <iostream>
#include <fstream>
@ -106,21 +107,21 @@ StateManager::load(const string& filename)
string s;
is >> s;
if (s != "window_location") throw "Corrupt settings file.";
if (s != "window_location") throw std::runtime_error("Corrupt settings file.");
is >> s;
_window_location.x = atoi(s.c_str());
is >> s;
_window_location.y = atoi(s.c_str());
is >> s;
if (s != "window_size") throw "Corrupt settings file.";
if (s != "window_size") throw std::runtime_error("Corrupt settings file.");
is >> s;
_window_size.x = atoi(s.c_str());
is >> s;
_window_size.y = atoi(s.c_str());
is >> s;
if (s != "zoom_level") throw "Corrupt settings file.";
if (s != "zoom_level") throw std::runtime_error("Corrupt settings file.");
is >> s;
_zoom = atof(s.c_str());
@ -150,7 +151,7 @@ StateManager::load(const string& filename)
if (s == "input") ml.type = Input;
else if (s == "output") ml.type = Output;
else if (s == "inputoutput") ml.type = InputOutput;
else throw "Corrupt settings file.";
else throw std::runtime_error("Corrupt settings file.");
is >> s;
ml.loc.x = atoi(s.c_str());
@ -182,7 +183,7 @@ StateManager::save(const string& filename)
if (ml.type == Input) os << " input ";
else if (ml.type == Output) os << " output ";
else if (ml.type == InputOutput) os << " inputoutput ";
else throw;
else throw std::runtime_error("Invalid module type");
os << ml.loc.x << " " << ml.loc.y << std::endl;
}

View File

@ -19,6 +19,7 @@
#include <iostream>
#include <libgnomecanvasmm.h>
#include <glibmm/exception.h>
#include "Patchage.h"
#include "JackDriver.h"
@ -39,8 +40,14 @@ int main(int argc, char** argv)
app.run(*patchage.window());
} catch (std::string msg) {
std::cerr << "Caught exception, aborting. Error message was: " << msg << std::endl;
} catch (std::exception& e) {
std::cerr << "Caught exception, aborting. Error message was: "
<< e.what() << std::endl;
return 1;
} catch (Glib::Exception& e) {
std::cerr << "Caught exception, aborting. Error message was: "
<< e.what() << std::endl;
return 1;
}