nicer error formatting of ogr layer names
This commit is contained in:
parent
1449190c41
commit
baa2880dad
1 changed files with 6 additions and 1 deletions
|
@ -203,6 +203,7 @@ void ogr_datasource::bind() const
|
||||||
|
|
||||||
unsigned num_layers = dataset_->GetLayerCount();
|
unsigned num_layers = dataset_->GetLayerCount();
|
||||||
bool layer_found = false;
|
bool layer_found = false;
|
||||||
|
std::vector<std::string> layer_names;
|
||||||
for (unsigned i = 0; i < num_layers; ++i )
|
for (unsigned i = 0; i < num_layers; ++i )
|
||||||
{
|
{
|
||||||
OGRLayer* ogr_layer = dataset_->GetLayer(i);
|
OGRLayer* ogr_layer = dataset_->GetLayer(i);
|
||||||
|
@ -210,7 +211,7 @@ void ogr_datasource::bind() const
|
||||||
if (ogr_layer_def != 0)
|
if (ogr_layer_def != 0)
|
||||||
{
|
{
|
||||||
layer_found = true;
|
layer_found = true;
|
||||||
s << " '" << ogr_layer_def->GetName() << "' ";
|
layer_names.push_back(std::string("'") + ogr_layer_def->GetName() + std::string("'"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +219,10 @@ void ogr_datasource::bind() const
|
||||||
{
|
{
|
||||||
s << "None (no layers were found in dataset)";
|
s << "None (no layers were found in dataset)";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s << boost::algorithm::join(layer_names,", ");
|
||||||
|
}
|
||||||
|
|
||||||
throw datasource_exception(s.str());
|
throw datasource_exception(s.str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue