Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-3_28] [processing] Don't raise uncaught exceptions when trying to generate GDAL commands for invalid layers #52001

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
QSizePolicy,
QDialogButtonBox)

from qgis.core import (QgsProcessingFeedback,
QgsProcessingParameterDefinition)
from qgis.core import (
QgsProcessingException,
QgsProcessingFeedback,
QgsProcessingParameterDefinition
)
from qgis.gui import (QgsMessageBar,
QgsProjectionSelectionWidget,
QgsProcessingAlgorithmDialogBase,
Expand Down Expand Up @@ -140,9 +143,12 @@ def parametersHaveChanged(self):
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:
Expand Down