From ff01b1fcce8fa64d4f51d4f5ee9fba563f58ae38 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 30 Oct 2014 19:05:50 +0200 Subject: [PATCH] server/state: throw interface::TargetModuleNotAvailable instead of Exception --- src/interface/server.h | 9 ++++----- src/server/state.cpp | 13 ++----------- src/server/state.h | 2 -- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/interface/server.h b/src/interface/server.h index 2ead92d..5bb9136 100644 --- a/src/interface/server.h +++ b/src/interface/server.h @@ -50,12 +50,11 @@ namespace interface ModuleUnloadedEvent(const ss_ &name): name(name){} }; - /*// Occurs when trying to access a module using access_module(), but it has + // Occurs when trying to access a module using access_module(), but it has // been stopped (and possibly deleted) - struct TargetModuleStopped: public Exception { - ss_ msg; - TargetModuleStopped(const ss_ &msg): Exception(msg){} - };*/ + struct TargetModuleNotAvailable: public Exception { + TargetModuleNotAvailable(const ss_ &msg): Exception(msg){} + }; struct Server { diff --git a/src/server/state.cpp b/src/server/state.cpp index b31e1c5..d91fcf4 100644 --- a/src/server/state.cpp +++ b/src/server/state.cpp @@ -193,17 +193,8 @@ struct ModuleContainer // Return an exception to make sure the caller doesn't continue // without knowing what it's doing ss_ caller_name = caller_mc ? caller_mc->info.name : "__unknown"; - /*try { - // TODO: Use a more specific exception - throw Exception("Target module ["+info.name+"] is stopping" - " - called by ["+caller_name+"]"); - } catch(...){ - // Return it the exception this way so that the caller can - // record the backtrace - result_exception = std::current_exception(); - } - return;*/ - throw Exception("Target module ["+info.name+"] is stopping - " + throw interface::TargetModuleNotAvailable( + "Target module ["+info.name+"] is stopping - " "called by ["+caller_name+"]"); } } diff --git a/src/server/state.h b/src/server/state.h index 1df683f..37ae841 100644 --- a/src/server/state.h +++ b/src/server/state.h @@ -17,12 +17,10 @@ namespace interface namespace server { struct ServerShutdownRequest: public Exception { - ss_ msg; ServerShutdownRequest(const ss_ &msg): Exception(msg){} }; struct ModuleNotFoundException: public Exception { - ss_ msg; ModuleNotFoundException(const ss_ &msg): Exception(msg){} };