mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
[processing] Don't raise uncaught exceptions when trying to generate
GDAL commands for invalid layers This is a partial fix, which at least removes the uncaught exception. Ideally we'd gracefully fall back to using the layer's source (even if it doesn't exist!) in the generated GDAL commands. But that's far from trivial to do. Fixes #51958
This commit is contained in:
parent
51e41d2ff1
commit
84c3613cf7
@ -33,8 +33,11 @@ from qgis.PyQt.QtWidgets import (QWidget,
|
||||
QSizePolicy,
|
||||
QDialogButtonBox)
|
||||
|
||||
from qgis.core import (QgsProcessingFeedback,
|
||||
QgsProcessingParameterDefinition)
|
||||
from qgis.core import (
|
||||
QgsProcessingException,
|
||||
QgsProcessingFeedback,
|
||||
QgsProcessingParameterDefinition
|
||||
)
|
||||
from qgis.gui import (QgsMessageBar,
|
||||
QgsProjectionSelectionWidget,
|
||||
QgsProcessingAlgorithmDialogBase,
|
||||
@ -140,9 +143,12 @@ class GdalParametersPanel(ParametersPanel):
|
||||
self.text.setPlainText('')
|
||||
return
|
||||
|
||||
commands = self.algorithm().getConsoleCommands(parameters, context, feedback, executing=False)
|
||||
commands = [c for c in commands if c not in ['cmd.exe', '/C ']]
|
||||
self.text.setPlainText(" ".join(commands))
|
||||
try:
|
||||
commands = self.algorithm().getConsoleCommands(parameters, context, feedback, executing=False)
|
||||
commands = [c for c in commands if c not in ['cmd.exe', '/C ']]
|
||||
self.text.setPlainText(" ".join(commands))
|
||||
except QgsProcessingException as e:
|
||||
self.text.setPlainText(str(e))
|
||||
except AlgorithmDialogBase.InvalidParameterValue as e:
|
||||
self.text.setPlainText(self.tr("Invalid value for parameter '{0}'").format(e.parameter.description()))
|
||||
except AlgorithmDialogBase.InvalidOutputExtension as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user