server/state: throw interface::TargetModuleNotAvailable instead of Exception

master
Perttu Ahola 2014-10-30 19:05:50 +02:00
parent 7e80e34cc6
commit ff01b1fcce
3 changed files with 6 additions and 18 deletions

View File

@ -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
{

View File

@ -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+"]");
}
}

View File

@ -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){}
};