Skip to content
Permalink
Browse files

Remove exception which is never raised

  • Loading branch information
nyalldawson committed Mar 3, 2020
1 parent 9ba699e commit 0fff9338bb89b92934bca9a1e9e03a585e3b2c22
@@ -29,7 +29,6 @@
from qgis.core import QgsApplication, QgsSettings, QgsProcessingModelAlgorithm

from processing.gui.ToolboxAction import ToolboxAction
from processing.modeler.exceptions import WrongModelException
from processing.modeler.ModelerUtils import ModelerUtils

pluginPath = os.path.split(os.path.dirname(__file__))[0]
@@ -23,15 +23,11 @@

import os

from qgis.PyQt.QtXml import QDomDocument

from qgis.core import (Qgis,
QgsApplication,
QgsProcessingProvider,
QgsMessageLog,
QgsProcessingModelAlgorithm,
QgsProcessingUtils,
QgsXmlUtils)
QgsProcessingModelAlgorithm)

from processing.core.ProcessingConfig import ProcessingConfig, Setting

@@ -45,7 +41,6 @@
from processing.modeler.EditModelAction import EditModelAction
from processing.modeler.ExportModelAsPythonScriptAction import ExportModelAsPythonScriptAction
from processing.modeler.OpenModelFromFileAction import OpenModelFromFileAction
from processing.modeler.exceptions import WrongModelException
from processing.modeler.ModelerUtils import ModelerUtils

pluginPath = os.path.split(os.path.dirname(__file__))[0]
@@ -120,17 +115,14 @@ def loadFromFolder(self, folder):
for path, subdirs, files in os.walk(folder):
for descriptionFile in files:
if descriptionFile.endswith('model3'):
try:
fullpath = os.path.join(path, descriptionFile)

alg = QgsProcessingModelAlgorithm()
if alg.fromFile(fullpath):
if alg.name():
alg.setSourceFilePath(fullpath)
self.algs.append(alg)
else:
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
self.tr('Processing'), Qgis.Critical)
except WrongModelException as e:
QgsMessageLog.logMessage(self.tr('Could not load model {0}\n{1}', 'ModelerAlgorithmProvider').format(descriptionFile, str(e)),
fullpath = os.path.join(path, descriptionFile)

alg = QgsProcessingModelAlgorithm()
if alg.fromFile(fullpath):
if alg.name():
alg.setSourceFilePath(fullpath)
self.algs.append(alg)
else:
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
self.tr('Processing'), Qgis.Critical)

@@ -18,9 +18,5 @@
"""


class WrongModelException(Exception):
pass


class UndefinedParameterException(Exception):
pass

0 comments on commit 0fff933

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