Merge pull request #70 from kisli/pr/69
Make serviceFactory::create throw instead of dying for invalid protocols.
This commit is contained in:
commit
87807e2186
@ -60,7 +60,12 @@ shared_ptr <service> serviceFactory::create
|
|||||||
(shared_ptr <session> sess, const string& protocol,
|
(shared_ptr <session> sess, const string& protocol,
|
||||||
shared_ptr <security::authenticator> auth)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user