File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -61,14 +61,16 @@ feedback object. E.g.
61
61
feedback.pushInfo('Feature {} was missing geometry, skipping'.format(f.id())
62
62
feedback.reportError('Input layer CRS is not valid, cannot reproject')
63
63
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
65
65
such as having no features in an input layer without throwing exceptions (instead, an empty layer should be output). This
66
66
allows more flexibility for users creating models. They may have created models which "route" features to different algorithms
67
67
based on some criteria, and it can be a valid case that no features satisfy this criteria. If your algorithm throws an
68
68
exception upon encountering an empty layer, it prevents it being used in these flexible models. Instead, use the feedback
69
69
object to pushInfo or reportError so that the lack of features is brought to user's attention (and logged) without breaking
70
70
the model execution.
71
71
72
+ - But if you MUST throw exceptions, use QgsProcessingException instead of the removed GeoAlgorithmExecutionException.
73
+
72
74
- Outputs are good! Declare as many outputs as useful from your algorithm. E.g. most algorithms should have at least a
73
75
FEATURE_COUNT number output which records the number of features processed by the algorithm. Other algorithms might want
74
76
to create numeric outputs for values like INTERSECTING_FEATURE_COUNT, NON_INTERSECTING_FEATURE_COUNT, etc. The more
You can’t perform that action at this time.
0 commit comments