Merge pull request #70 from kisli/pr/69

Make serviceFactory::create throw instead of dying for invalid protocols.
This commit is contained in:
Vincent Richard 2014-02-23 15:36:21 +01:00
commit 87807e2186

View File

@ -60,7 +60,12 @@ shared_ptr <service> serviceFactory::create
(shared_ptr <session> sess, const string& protocol,
shared_ptr <security::authenticator> auth)
{
return (getServiceByProtocol(protocol)->create(sess, auth));
shared_ptr <const registeredService> rserv = getServiceByProtocol(protocol);
if (!rserv)
throw exceptions::no_factory_available("No service is registered for protocol '" + protocol + "'.");
return rserv->create(sess, auth);
}