Skip to content

Commit

Permalink
Improved error reporting for unknown parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 6, 2018
1 parent cdef548 commit a1fc70f
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing.modeler.exceptions import UndefinedParameterException

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down Expand Up @@ -399,9 +400,12 @@ def accept(self):
isinstance(self.param, QgsProcessingParameterCrs)):
self.param = QgsProcessingParameterCrs(name, description, self.selector.crs().authid())
else:
paramType = QgsApplication.instance().processingRegistry().parameterType(self.paramType)
self.param = paramType.create(name)
self.param.setMetadata(paramType.metadata())
paramTypeDef = QgsApplication.instance().processingRegistry().parameterType(self.paramType)
if not paramTypeDef:
msg = self.tr('The parameter `{}` is not registered, are you missing a required plugin?'.format(self.paramType))
raise UndefinedParameterException(msg)
self.param = paramTypeDef.create(name)
self.param.setMetadata(paramTypeDef.metadata())

if not self.requiredCheck.isChecked():
self.param.setFlags(self.param.flags() | QgsProcessingParameterDefinition.FlagOptional)
Expand Down

0 comments on commit a1fc70f

Please sign in to comment.