Skip to content
This repository
Browse code

nicer error formatting of ogr layer names

  • Loading branch information...
commit baa2880dad9c241bd5f90a713a5acd94bebecf8b 1 parent 1449190
Dane Springmeyer authored October 09, 2012

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  plugins/input/ogr/ogr_datasource.cpp
7  plugins/input/ogr/ogr_datasource.cpp
@@ -203,6 +203,7 @@ void ogr_datasource::bind() const
203 203
 
204 204
         unsigned num_layers = dataset_->GetLayerCount();
205 205
         bool layer_found = false;
  206
+        std::vector<std::string> layer_names;
206 207
         for (unsigned i = 0; i < num_layers; ++i )
207 208
         {
208 209
             OGRLayer* ogr_layer = dataset_->GetLayer(i);
@@ -210,7 +211,7 @@ void ogr_datasource::bind() const
210 211
             if (ogr_layer_def != 0)
211 212
             {
212 213
                 layer_found = true;
213  
-                s << " '" << ogr_layer_def->GetName() << "' ";
  214
+                layer_names.push_back(std::string("'") + ogr_layer_def->GetName() + std::string("'"));
214 215
             }
215 216
         }
216 217
 
@@ -218,6 +219,10 @@ void ogr_datasource::bind() const
218 219
         {
219 220
             s << "None (no layers were found in dataset)";
220 221
         }
  222
+        else
  223
+        {
  224
+            s << boost::algorithm::join(layer_names,", ");
  225
+        }
221 226
 
222 227
         throw datasource_exception(s.str());
223 228
     }

0 notes on commit baa2880

Please sign in to comment.
Something went wrong with that request. Please try again.