Skip to content
Permalink
Browse files

[processing] stop algorithm execution if geometry/feature error occured

(fix #11986)
  • Loading branch information
alexbruy committed May 13, 2017
1 parent 75e9502 commit c620c7c306e9f2fdc7d9f68352f31820fce1d222
Showing with 9 additions and 5 deletions.
  1. +9 −5 python/plugins/processing/algs/qgis/Intersection.py
@@ -36,6 +36,7 @@
QgsMessageLog,
QgsProcessingUtils)

from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.outputs import OutputVector
@@ -114,9 +115,10 @@ def processAlgorithm(self, context, feedback):
int_sym = geom.symDifference(tmpGeom)
int_geom = QgsGeometry(int_com.difference(int_sym))
if int_geom.isEmpty() or not int_geom.isGeosValid():
QgsMessageLog.logMessage(self.tr('GEOS geoprocessing error: One or '
'more input features have invalid '
'geometry.'), self.tr('Processing'), QgsMessageLog.CRITICAL)
raise GeoAlgorithmExecutionException(
self.tr('GEOS geoprocessing error: One or '
'more input features have invalid '
'geometry.'))
try:
if int_geom.wkbType() in wkbTypeGroups[wkbTypeGroups[int_geom.wkbType()]]:
outFeat.setGeometry(int_geom)
@@ -126,7 +128,9 @@ def processAlgorithm(self, context, feedback):
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
except:
QgsMessageLog.logMessage(self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'), self.tr('Processing'), QgsMessageLog.INFO)
continue
raise GeoAlgorithmExecutionException(
self.tr('Feature geometry error: One or more '
'output features ignored due to invalid '
'geometry.'))

del writer

0 comments on commit c620c7c

Please sign in to comment.
You can’t perform that action at this time.