Skip to content

Commit e039a06

Browse files
committed
Add note on GeoAlgorithmExecutionException
1 parent 4e2605b commit e039a06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/porting_processing.dox

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ feedback object. E.g.
6161
feedback.pushInfo('Feature {} was missing geometry, skipping'.format(f.id())
6262
feedback.reportError('Input layer CRS is not valid, cannot reproject')
6363

64-
- Use geoprocessingexception only for FATAL errors which force a model to terminate. Algorithms should handle common cases
64+
- Use exceptions only for FATAL errors which force a model to terminate. Algorithms should handle common cases
6565
such as having no features in an input layer without throwing exceptions (instead, an empty layer should be output). This
6666
allows more flexibility for users creating models. They may have created models which "route" features to different algorithms
6767
based on some criteria, and it can be a valid case that no features satisfy this criteria. If your algorithm throws an
6868
exception upon encountering an empty layer, it prevents it being used in these flexible models. Instead, use the feedback
6969
object to pushInfo or reportError so that the lack of features is brought to user's attention (and logged) without breaking
7070
the model execution.
7171

72+
- But if you MUST throw exceptions, use QgsProcessingException instead of the removed GeoAlgorithmExecutionException.
73+
7274
- Outputs are good! Declare as many outputs as useful from your algorithm. E.g. most algorithms should have at least a
7375
FEATURE_COUNT number output which records the number of features processed by the algorithm. Other algorithms might want
7476
to create numeric outputs for values like INTERSECTING_FEATURE_COUNT, NON_INTERSECTING_FEATURE_COUNT, etc. The more

0 commit comments

Comments
 (0)