improve error message when datasource plugin is not available
This commit is contained in:
parent
a62e791d73
commit
10f6fbc731
1 changed files with 12 additions and 2 deletions
|
@ -36,6 +36,7 @@
|
||||||
// stl
|
// stl
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
@ -73,8 +74,17 @@ datasource_ptr datasource_cache::create(const parameters& params, bool bind)
|
||||||
std::map<std::string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(*type);
|
std::map<std::string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(*type);
|
||||||
if ( itr == plugins_.end() )
|
if ( itr == plugins_.end() )
|
||||||
{
|
{
|
||||||
throw config_error(std::string("Could not create datasource. No plugin ") +
|
std::ostringstream s;
|
||||||
"found for type '" + * type + "' (searched in: " + plugin_directories() + ")");
|
s << "Could not create datasource for type: '" << *type << "'";
|
||||||
|
if (plugin_directories_.empty())
|
||||||
|
{
|
||||||
|
s << " (no datasource plugin directories have been successfully registered)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s << " (searched for datasource plugins in '" << plugin_directories() << "')";
|
||||||
|
}
|
||||||
|
throw config_error(s.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! itr->second->handle())
|
if ( ! itr->second->handle())
|
||||||
|
|
Loading…
Reference in a new issue