Make serviceFactory::create throw instead of dying for invalid protocols.

This commit is contained in:
Vincent Richard 2014-02-23 15:34:35 +01:00
parent c13683466a
commit 0b03b3267c

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