ensure proper error output from postgis plugin - refs #955

This commit is contained in:
Dane Springmeyer 2011-11-17 11:36:16 -08:00
parent a6abfe5ff0
commit e99e6da1e5

View File

@ -95,7 +95,8 @@ public:
}
if(!result || (PQresultStatus(result) != PGRES_TUPLES_OK))
{
std::ostringstream s("Postgis Plugin: PSQL error");
std::ostringstream s;
s << "Postgis Plugin: PSQL error";
if (conn_ )
{
std::string msg = PQerrorMessage( conn_ );
@ -106,6 +107,10 @@ public:
s << "\nFull sql was: '" << sql << "'\n";
}
else
{
s << "unable to connect to database";
}
if (result)
PQclear(result);
throw mapnik::datasource_exception( s.str() );