Permalink
Browse files

nicer error formatting of ogr layer names

  • Loading branch information...
Dane Springmeyer
Dane Springmeyer committed Oct 9, 2012
1 parent 1449190 commit baa2880dad9c241bd5f90a713a5acd94bebecf8b
Showing with 6 additions and 1 deletion.
  1. +6 −1 plugins/input/ogr/ogr_datasource.cpp
@@ -203,21 +203,26 @@ void ogr_datasource::bind() const
unsigned num_layers = dataset_->GetLayerCount();
bool layer_found = false;
+ std::vector<std::string> layer_names;
for (unsigned i = 0; i < num_layers; ++i )
{
OGRLayer* ogr_layer = dataset_->GetLayer(i);
OGRFeatureDefn* ogr_layer_def = ogr_layer->GetLayerDefn();
if (ogr_layer_def != 0)
{
layer_found = true;
- s << " '" << ogr_layer_def->GetName() << "' ";
+ layer_names.push_back(std::string("'") + ogr_layer_def->GetName() + std::string("'"));
}
}
if (! layer_found)
{
s << "None (no layers were found in dataset)";
}
+ else
+ {
+ s << boost::algorithm::join(layer_names,", ");
+ }
throw datasource_exception(s.str());
}

0 comments on commit baa2880

Please sign in to comment.