class_registrator: make no_such_class message more informative

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
This commit is contained in:
Paweł Dziepak
2015-06-08 10:23:38 +03:00
committed by Avi Kivity
parent b96f2d4cee
commit bfe6446a89
2 changed files with 2 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ public:
// is fine. Also, we don't want to change its type.
throw;
} catch (no_such_class& nc) {
throw make_exception<InvalidRequestException>("unable to find class '%s'", nc.what());
throw make_exception<InvalidRequestException>(nc.what());
} catch (std::exception& e) {
// Unexpected exception, wrap it
throw ::apache::thrift::TException(std::string("Internal server error: ") + e.what());

View File

@@ -52,7 +52,7 @@ template<typename BaseType, typename... Args>
std::unique_ptr<BaseType> class_registry<BaseType, Args...>::create(const sstring& name, Args... args) {
auto it = _classes.find(name);
if (it == _classes.end()) {
throw no_such_class(name);
throw no_such_class(sstring("unable to find class '") + name + sstring("'"));
}
return it->second(args...);
}