Skip to content
Permalink
Browse files

[processing] More helpful errors when sources cannot be loaded

Include descriptive text with the specified parameter value
in error, and always check that sources were loaded to avoid
raw Python exceptions when they are not
  • Loading branch information
nyalldawson committed Apr 27, 2018
1 parent 199af26 commit 5339d62715f4faaf0ed04bdec97335a7abecdd7c
Showing with 469 additions and 43 deletions.
  1. +26 −0 python/core/processing/qgsprocessingalgorithm.sip.in
  2. +5 −1 python/plugins/processing/algs/gdal/Buffer.py
  3. +4 −0 python/plugins/processing/algs/gdal/ClipVectorByExtent.py
  4. +6 −1 python/plugins/processing/algs/gdal/Dissolve.py
  5. +6 −1 python/plugins/processing/algs/gdal/OffsetCurve.py
  6. +6 −1 python/plugins/processing/algs/gdal/OneSideBuffer.py
  7. +7 −2 python/plugins/processing/algs/gdal/PointsAlongLines.py
  8. +3 −0 python/plugins/processing/algs/qgis/Aggregate.py
  9. +3 −0 python/plugins/processing/algs/qgis/BarPlot.py
  10. +4 −0 python/plugins/processing/algs/qgis/BasicStatistics.py
  11. +5 −1 python/plugins/processing/algs/qgis/BoxPlot.py
  12. +3 −0 python/plugins/processing/algs/qgis/CheckValidity.py
  13. +3 −0 python/plugins/processing/algs/qgis/ConcaveHull.py
  14. +2 −0 python/plugins/processing/algs/qgis/Delaunay.py
  15. +4 −0 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  16. +4 −0 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  17. +3 −0 python/plugins/processing/algs/qgis/ExtractSpecificVertices.py
  18. +3 −0 python/plugins/processing/algs/qgis/FieldPyculator.py
  19. +3 −0 python/plugins/processing/algs/qgis/FieldsCalculator.py
  20. +3 −0 python/plugins/processing/algs/qgis/FieldsMapper.py
  21. +3 −0 python/plugins/processing/algs/qgis/FindProjection.py
  22. +3 −0 python/plugins/processing/algs/qgis/GeometryConvert.py
  23. +2 −0 python/plugins/processing/algs/qgis/Heatmap.py
  24. +6 −0 python/plugins/processing/algs/qgis/HubDistanceLines.py
  25. +6 −0 python/plugins/processing/algs/qgis/HubDistancePoints.py
  26. +4 −0 python/plugins/processing/algs/qgis/HypsometricCurves.py
  27. +2 −0 python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
  28. +2 −0 python/plugins/processing/algs/qgis/ImportIntoSpatialite.py
  29. +4 −0 python/plugins/processing/algs/qgis/KeepNBiggestParts.py
  30. +4 −0 python/plugins/processing/algs/qgis/MeanAndStdDevPlot.py
  31. +4 −0 python/plugins/processing/algs/qgis/MinimumBoundingGeometry.py
  32. +4 −0 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  33. +7 −0 python/plugins/processing/algs/qgis/PointDistance.py
  34. +4 −0 python/plugins/processing/algs/qgis/PointsAlongGeometry.py
  35. +4 −0 python/plugins/processing/algs/qgis/PointsDisplacement.py
  36. +3 −0 python/plugins/processing/algs/qgis/PointsFromLines.py
  37. +3 −0 python/plugins/processing/algs/qgis/PointsFromPolygons.py
  38. +6 −0 python/plugins/processing/algs/qgis/PointsInPolygon.py
  39. +3 −0 python/plugins/processing/algs/qgis/PointsLayerFromTable.py
  40. +4 −0 python/plugins/processing/algs/qgis/PointsToPaths.py
  41. +5 −1 python/plugins/processing/algs/qgis/PolarPlot.py
  42. +3 −0 python/plugins/processing/algs/qgis/PoleOfInaccessibility.py
  43. +4 −0 python/plugins/processing/algs/qgis/Polygonize.py
  44. +3 −0 python/plugins/processing/algs/qgis/RandomExtract.py
  45. +3 −0 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  46. +3 −0 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  47. +3 −0 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  48. +3 −0 python/plugins/processing/algs/qgis/RandomPointsPolygons.py
  49. +4 −0 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  50. +4 −0 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  51. +7 −0 python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
  52. +4 −0 python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
  53. +7 −0 python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py
  54. +7 −0 python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py
  55. +3 −0 python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
  56. +6 −0 python/plugins/processing/algs/qgis/SnapGeometries.py
  57. +7 −0 python/plugins/processing/algs/qgis/SpatialJoin.py
  58. +7 −0 python/plugins/processing/algs/qgis/SpatialJoinSummary.py
  59. +4 −0 python/plugins/processing/algs/qgis/StatisticsByCategories.py
  60. +6 −0 python/plugins/processing/algs/qgis/SumLines.py
  61. +4 −0 python/plugins/processing/algs/qgis/TopoColors.py
  62. +4 −0 python/plugins/processing/algs/qgis/UniqueValues.py
  63. +3 −0 python/plugins/processing/algs/qgis/VariableDistanceBuffer.py
  64. +5 −1 python/plugins/processing/algs/qgis/VectorLayerHistogram.py
  65. +5 −1 python/plugins/processing/algs/qgis/VectorLayerScatterplot.py
  66. +5 −1 python/plugins/processing/algs/qgis/VectorLayerScatterplot3D.py
  67. +4 −0 python/plugins/processing/algs/qgis/VectorSplit.py
  68. +3 −0 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  69. +6 −0 python/plugins/processing/algs/saga/SagaAlgorithm.py
  70. +9 −0 python/plugins/processing/script/ScriptTemplate.py
  71. +2 −2 src/analysis/processing/qgsalgorithmbuffer.cpp
  72. +2 −2 src/analysis/processing/qgsalgorithmclip.cpp
  73. +2 −2 src/analysis/processing/qgsalgorithmdifference.cpp
  74. +1 −1 src/analysis/processing/qgsalgorithmdissolve.cpp
  75. +1 −1 src/analysis/processing/qgsalgorithmextractbyattribute.cpp
  76. +1 −1 src/analysis/processing/qgsalgorithmextractbyexpression.cpp
  77. +1 −1 src/analysis/processing/qgsalgorithmextractbyextent.cpp
  78. +6 −0 src/analysis/processing/qgsalgorithmextractbylocation.cpp
  79. +1 −1 src/analysis/processing/qgsalgorithmextractvertices.cpp
  80. +1 −1 src/analysis/processing/qgsalgorithmfilter.cpp
  81. +2 −2 src/analysis/processing/qgsalgorithmintersection.cpp
  82. +5 −2 src/analysis/processing/qgsalgorithmjoinbyattribute.cpp
  83. +4 −1 src/analysis/processing/qgsalgorithmjoinwithlines.cpp
  84. +2 −2 src/analysis/processing/qgsalgorithmlineintersection.cpp
  85. +1 −1 src/analysis/processing/qgsalgorithmmeancoordinates.cpp
  86. +1 −1 src/analysis/processing/qgsalgorithmorderbyexpression.cpp
  87. +1 −1 src/analysis/processing/qgsalgorithmremovenullgeometry.cpp
  88. +2 −2 src/analysis/processing/qgsalgorithmsplitwithlines.cpp
  89. +2 −2 src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp
  90. +1 −1 src/analysis/processing/qgsalgorithmtransect.cpp
  91. +2 −2 src/analysis/processing/qgsalgorithmunion.cpp
  92. +1 −1 src/analysis/processing/qgsalgorithmuniquevalueindex.cpp
  93. +66 −2 src/core/processing/qgsprocessingalgorithm.cpp
  94. +26 −0 src/core/processing/qgsprocessingalgorithm.h
  95. +13 −0 tests/src/analysis/testqgsprocessing.cpp
@@ -744,6 +744,32 @@ Evaluates the parameter with matching ``name`` to a range of values.
QStringList parameterAsFields( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;
%Docstring
Evaluates the parameter with matching ``name`` to a list of fields.
%End

static QString invalidSourceError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a source parameter could
not be loaded.

The ``parameters`` argument should give the algorithms parameter map, and the ``name``
should correspond to the invalid source parameter name.

.. versionadded:: 3.2

.. seealso:: :py:func:`invalidSinkError`
%End

static QString invalidSinkError( const QVariantMap &parameters, const QString &name );
%Docstring
Returns a user-friendly string to use as an error when a sink parameter could
not be created.

The ``parameters`` argument should give the algorithms parameter map, and the ``name``
should correspond to the invalid source parameter name.

.. versionadded:: 3.2

.. seealso:: :py:func:`invalidSourceError`
%End

private:
@@ -32,6 +32,7 @@
QgsProcessingParameterField,
QgsProcessingParameterString,
QgsProcessingParameterNumber,
QgsProcessingException,
QgsProcessingParameterBoolean,
QgsProcessingParameterVectorDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
@@ -103,7 +104,10 @@ def commandName(self):
return 'ogr2ogr'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
fields = self.parameterAsSource(parameters, self.INPUT, context).fields()
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))
fields = source.fields()
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
distance = self.parameterAsDouble(parameters, self.DISTANCE, context)
@@ -27,6 +27,7 @@

from qgis.core import (QgsVectorLayer,
QgsProcessing,
QgsProcessingException,
QgsProcessingParameterDefinition,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterExtent,
@@ -80,6 +81,9 @@ def commandName(self):
def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

extent = self.parameterAsExtent(parameters, self.EXTENT, context, source.sourceCrs())
options = self.parameterAsString(parameters, self.OPTIONS, context)
outFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

from qgis.core import (QgsProcessing,
QgsProcessingException,
QgsProcessingParameterDefinition,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
@@ -113,7 +114,11 @@ def commandName(self):
return 'ogr2ogr'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
fields = self.parameterAsSource(parameters, self.INPUT, context).fields()
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = source.fields()
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
fieldName = self.parameterAsString(parameters, self.FIELD, context)
@@ -30,6 +30,7 @@
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterString,
QgsProcessingException,
QgsProcessingParameterNumber,
QgsProcessingParameterVectorDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
@@ -86,7 +87,11 @@ def commandName(self):
return 'ogr2ogr'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
fields = self.parameterAsSource(parameters, self.INPUT, context).fields()
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = source.fields()
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
distance = self.parameterAsDouble(parameters, self.DISTANCE, context)
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

from qgis.core import (QgsProcessing,
QgsProcessingException,
QgsProcessingParameterDefinition,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
@@ -112,7 +113,11 @@ def commandName(self):
return 'ogr2ogr'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
fields = self.parameterAsSource(parameters, self.INPUT, context).fields()
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = source.fields()
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
distance = self.parameterAsDouble(parameters, self.DISTANCE, context)
@@ -25,7 +25,8 @@

__revision__ = '$Format:%H$'

from qgis.core import (QgsProcessingParameterFeatureSource,
from qgis.core import (QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterString,
QgsProcessingParameterNumber,
QgsProcessingParameterVectorDestination,
@@ -90,7 +91,11 @@ def commandName(self):
return 'ogr2ogr'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
fields = self.parameterAsSource(parameters, self.INPUT, context).fields()
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = source.fields()
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
distance = self.parameterAsDouble(parameters, self.DISTANCE, context)
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
@@ -131,6 +131,9 @@ def parameterAsAggregates(self, parameters, name, context):

def prepareAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

group_by = self.parameterAsExpression(parameters, self.GROUP_BY, context)
aggregates = self.parameterAsAggregates(parameters, self.AGGREGATES, context)

@@ -31,6 +31,7 @@

from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingException,
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector
@@ -72,6 +73,8 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

namefieldname = self.parameterAsString(parameters, self.NAME_FIELD, context)
valuefieldname = self.parameterAsString(parameters, self.VALUE_FIELD, context)
@@ -35,6 +35,7 @@
QgsStringStatisticalSummary,
QgsDateTimeStatisticalSummary,
QgsFeatureRequest,
QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
@@ -128,6 +129,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT_LAYER, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

field_name = self.parameterAsString(parameters, self.FIELD_NAME, context)
field = source.fields().at(source.fields().lookupField(field_name))

@@ -28,7 +28,8 @@
import plotly as plt
import plotly.graph_objs as go

from qgis.core import (QgsProcessingParameterFeatureSource,
from qgis.core import (QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterEnum,
QgsProcessingParameterFileDestination,
@@ -84,6 +85,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

namefieldname = self.parameterAsString(parameters, self.NAME_FIELD, context)
valuefieldname = self.parameterAsString(parameters, self.VALUE_FIELD, context)

@@ -39,6 +39,7 @@
QgsWkbTypes,
QgsFields,
QgsProcessing,
QgsProcessingException,
QgsProcessingFeatureSource,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterEnum,
@@ -121,6 +122,8 @@ def processAlgorithm(self, parameters, context, feedback):

def doCheck(self, method, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT_LAYER, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

(valid_output_sink, valid_output_dest_id) = self.parameterAsSink(parameters, self.VALID_OUTPUT, context,
source.fields(), source.wkbType(), source.sourceCrs())
@@ -79,6 +79,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
layer = self.parameterAsSource(parameters, ConcaveHull.INPUT, context)
if layer is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

alpha = self.parameterAsDouble(parameters, self.ALPHA, context)
holes = self.parameterAsBool(parameters, self.HOLES, context)
no_multigeom = self.parameterAsBool(parameters, self.NO_MULTIGEOMETRY, context)
@@ -79,6 +79,8 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = QgsFields()
fields.append(QgsField('POINTA', QVariant.Double, '', 24, 15))
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

from qgis.core import (QgsFeatureRequest,
QgsProcessingException,
QgsFeatureSink,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFeatureSink)
@@ -59,6 +60,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
source.fields(), source.wkbType(), source.sourceCrs())

@@ -40,6 +40,7 @@
QgsFeatureSink,
QgsDistanceArea,
QgsProcessingUtils,
QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterEnum,
QgsProcessingParameterFeatureSink)
@@ -92,6 +93,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

method = self.parameterAsEnum(parameters, self.METHOD, context)

wkb_type = source.wkbType()
@@ -77,6 +77,9 @@ def tags(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

fields = source.fields()
fields.append(QgsField('vertex_pos', QVariant.Int))
fields.append(QgsField('vertex_index', QVariant.Int))
@@ -91,6 +91,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

field_name = self.parameterAsString(parameters, self.FIELD_NAME, context)
field_type = self.TYPES[self.parameterAsEnum(parameters, self.FIELD_TYPE, context)]
width = self.parameterAsInt(parameters, self.FIELD_LENGTH, context)
@@ -94,6 +94,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

layer = self.parameterAsVectorLayer(parameters, self.INPUT, context)
field_name = self.parameterAsString(parameters, self.FIELD_NAME, context)
field_type = self.TYPES[self.parameterAsEnum(parameters, self.FIELD_TYPE, context)]
@@ -81,6 +81,9 @@ def parameterAsFieldsMapping(self, parameters, name, context):

def prepareAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, 'INPUT', context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

mapping = self.parameterAsFieldsMapping(parameters, self.FIELDS_MAPPING, context)

self.fields = QgsFields()
@@ -36,6 +36,7 @@
QgsCoordinateTransform,
QgsCoordinateTransformContext,
QgsWkbTypes,
QgsProcessingException,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterExtent,
QgsProcessingParameterCrs,
@@ -86,6 +87,8 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

extent = self.parameterAsExtent(parameters, self.TARGET_AREA, context)
target_crs = self.parameterAsCrs(parameters, self.TARGET_AREA_CRS, context)
@@ -77,6 +77,9 @@ def displayName(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

index = self.parameterAsEnum(parameters, self.TYPE, context)

if index == 0:
@@ -176,6 +176,8 @@ def clone(self):

def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
if source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

radius = self.parameterAsDouble(parameters, self.RADIUS, context)
kernel_shape = self.parameterAsEnum(parameters, self.KERNEL, context)
@@ -102,7 +102,13 @@ def processAlgorithm(self, parameters, context, feedback):
self.tr('Same layer given for both hubs and spokes'))

point_source = self.parameterAsSource(parameters, self.INPUT, context)
if point_source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

hub_source = self.parameterAsSource(parameters, self.HUBS, context)
if hub_source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.HUBS))

fieldName = self.parameterAsString(parameters, self.FIELD, context)

units = self.UNITS[self.parameterAsEnum(parameters, self.UNIT, context)]
@@ -98,7 +98,13 @@ def processAlgorithm(self, parameters, context, feedback):
self.tr('Same layer given for both hubs and spokes'))

point_source = self.parameterAsSource(parameters, self.INPUT, context)
if point_source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT))

hub_source = self.parameterAsSource(parameters, self.HUBS, context)
if hub_source is None:
raise QgsProcessingException(self.invalidSourceError(parameters, self.HUBS))

fieldName = self.parameterAsString(parameters, self.FIELD, context)

units = self.UNITS[self.parameterAsEnum(parameters, self.UNIT, context)]

0 comments on commit 5339d62

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