summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Patchage.cpp7
-rw-r--r--src/StateManager.cpp11
-rw-r--r--src/main.cpp11
3 files changed, 16 insertions, 13 deletions
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 0e73a37..4e48bb0 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -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);
diff --git a/src/StateManager.cpp b/src/StateManager.cpp
index f00daa8..85a78cf 100644
--- a/src/StateManager.cpp
+++ b/src/StateManager.cpp
@@ -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;
}
diff --git a/src/main.cpp b/src/main.cpp
index 271b312..c514e33 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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;
}