Skip to content

Commit

Permalink
catch exceptions in QgsSpatialIndex
Browse files Browse the repository at this point in the history
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 56e6167
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/core/spatialindex/qgsspatialindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsgeometry.h"
#include "qgsfeature.h"
#include "qgsrect.h"
#include "qgslogger.h"

#include "SpatialIndex.h"

Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 56e6167

Please sign in to comment.