From 10f6fbc731a7e8b77824ce035d8f4ca88eadbd22 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 30 Oct 2012 11:00:24 -0700 Subject: [PATCH] improve error message when datasource plugin is not available --- src/datasource_cache.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index b0780986d..04bfe209a 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -36,6 +36,7 @@ // stl #include #include +#include #include namespace mapnik { @@ -73,8 +74,17 @@ datasource_ptr datasource_cache::create(const parameters& params, bool bind) std::map >::iterator itr=plugins_.find(*type); if ( itr == plugins_.end() ) { - throw config_error(std::string("Could not create datasource. No plugin ") + - "found for type '" + * type + "' (searched in: " + plugin_directories() + ")"); + std::ostringstream s; + 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())