- improved error reporting in shape plugin

This commit is contained in:
Lucio Asnaghi 2010-11-29 09:15:43 +00:00
parent 46228e8bfc
commit 9b3ef53338
4 changed files with 11 additions and 11 deletions

View file

@ -123,12 +123,12 @@ void shape_datasource::bind() const
} }
catch (datasource_exception& ex) catch (datasource_exception& ex)
{ {
std::clog<<ex.what()<<std::endl; std::clog << "Shape Plugin: error processing field attributes, " << ex.what() << std::endl;
throw; throw;
} }
catch (...) catch (...)
{ {
std::clog << "Shape Plugin: got exception... " << std::endl; std::clog << "Shape Plugin: error processing field attributes" << std::endl;
throw; throw;
} }

View file

@ -57,14 +57,14 @@ shape_featureset<filterT>::shape_featureset(const filterT& filter,
{ {
std::ostringstream s; std::ostringstream s;
s << "Shape Plugin: error no attribute by the name of '" << *pos << "'" s << "error no attribute by the name of '" << *pos << "'"
<< ", available attributes are:"; << ", available attributes are:";
for (int i=0;i<shape_.dbf().num_fields();++i) for (int i=0;i<shape_.dbf().num_fields();++i)
{ {
s << " '" << shape_.dbf().descriptor(i).name_ << "'"; s << " '" << shape_.dbf().descriptor(i).name_ << "'";
} }
throw mapnik::datasource_exception( s.str() ); throw mapnik::datasource_exception( "Shape Plugin: " + s.str() );
} }
++pos; ++pos;
} }

View file

@ -78,14 +78,14 @@ shape_index_featureset<filterT>::shape_index_featureset(const filterT& filter,
{ {
std::ostringstream s; std::ostringstream s;
s << "Shape Plugin: error no attribute by the name of '" << *pos << "'" s << "error no attribute by the name of '" << *pos << "'"
<< ", available attributes are:"; << ", available attributes are:";
for (int i=0;i<shape_.dbf().num_fields();++i) for (int i=0;i<shape_.dbf().num_fields();++i)
{ {
s << " '" << shape_.dbf().descriptor(i).name_ << "'"; s << " '" << shape_.dbf().descriptor(i).name_ << "'";
} }
throw mapnik::datasource_exception( s.str() ); throw mapnik::datasource_exception( "Shape Plugin: " + s.str() );
} }
++pos; ++pos;
} }
@ -224,7 +224,7 @@ feature_ptr shape_index_featureset<filterT>::next()
} }
catch (...) catch (...)
{ {
std::clog << "Shape Plugin: exception caught..." << std::endl; std::clog << "Shape Plugin: error processing attributes" << std::endl;
} }
++pos; ++pos;
} }

View file

@ -49,14 +49,14 @@ shape_io::shape_io(const std::string& shape_name)
{ {
if (!boost::filesystem::exists(shape_name + INDEX)) if (!boost::filesystem::exists(shape_name + INDEX))
{ {
throw datasource_exception("Shape Plugin: Warning - Could not open index: '" + shape_name + INDEX + "' does not exist"); throw datasource_exception("Shape Plugin: could not open index: '" + shape_name + INDEX + "' does not exist");
} }
index_= boost::shared_ptr<shape_file>(new shape_file(shape_name + INDEX)); index_= boost::shared_ptr<shape_file>(new shape_file(shape_name + INDEX));
} }
catch (...) catch (...)
{ {
std::cerr << "Shape Plugin: Warning - Could not open index: '" + shape_name + INDEX + "'" << std::endl; std::cerr << "Shape Plugin: warning - could not open index: '" + shape_name + INDEX + "'" << std::endl;
} }
} }