Skip to content
Permalink
Browse files
catch exceptions in QgsSpatialIndex
git-svn-id: http://svn.osgeo.org/qgis/trunk@9089 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 20, 2008
1 parent 731ec75 commit 56e6167fcebc1f2ab0cbee31a9478d1314a0f5fb
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/core/spatialindex/qgsspatialindex.cpp
@@ -19,6 +19,7 @@
#include "qgsgeometry.h"
#include "qgsfeature.h"
#include "qgsrect.h"
#include "qgslogger.h"

#include "SpatialIndex.h"

@@ -89,7 +90,7 @@ Tools::Geometry::Region QgsSpatialIndex::rectToRegion(QgsRect rect)

bool QgsSpatialIndex::featureInfo(QgsFeature& f, Tools::Geometry::Region& r, long& id)
{
QgsGeometry* g = f.geometry();
QgsGeometry *g = f.geometry();
if (!g)
return false;

@@ -105,8 +106,16 @@ bool QgsSpatialIndex::insertFeature(QgsFeature& f)
if (!featureInfo(f, r, id))
return false;

// TODO: handle possible exceptions
mRTree->insertData(0,0, r, id);
// TODO: handle possible exceptions correctly
try {
mRTree->insertData(0,0, r, id);
} catch(Tools::Exception &e) {
QgsDebugMsg( QString("Tools::Exception caught: ").arg(e.what().c_str()) );
} catch(const std::exception &e) {
QgsDebugMsg( QString("std::exception caught: ").arg(e.what()) );
} catch(...) {
QgsDebugMsg( "unknown spatial index exception caught" );
}

return true;
}

0 comments on commit 56e6167

Please sign in to comment.