Make serviceFactory::create throw instead of dying for invalid protocols.
This commit is contained in:
parent
c13683466a
commit
0b03b3267c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user