]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/application.cpp
Add new exception classes for some common errors
[libs/core.git] / source / core / application.cpp
index 8447eed669d2b8f58c9b078b547b1543b0bab27f..1b77a7c11273daadcf5c080fa77c369fe57ed65f 100644 (file)
@@ -9,6 +9,7 @@
 #include <msp/io/print.h>
 #include <msp/strings/utils.h>
 #include "application.h"
+#include "except.h"
 #include "getopt.h"
 
 using namespace std;
@@ -24,7 +25,7 @@ void *Application::_data = nullptr;
 Application::Application(const string &n)
 {
        if(_app)
-               throw logic_error("instance already exists");
+               throw already_called("Application::Application");
 
        if(!n.empty())
                _name = n;
@@ -94,7 +95,7 @@ int Application::run(int argc, char **argv, void *data, void (*created_callback)
 void Application::set_startup_info(const char *argv0, void *data)
 {
        if(_argv0)
-               throw logic_error("startup info already set");
+               throw already_called("Application::set_startup_info");
 
        static FS::Path exe;
 
@@ -146,7 +147,7 @@ void Application::_sighandler(int s)
 Application::Starter::Starter()
 {
        if(_starter)
-               throw logic_error("Can't create more than one Starter instance");
+               throw already_called("Application::Starter::Starter");
 
        _starter = this;
 }