Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Better error reporting for model exception
  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 6, 2018
1 parent a337d20 commit 031aa9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
Expand Up @@ -33,7 +33,7 @@
from qgis.core import QgsApplication, QgsSettings, QgsProcessingModelAlgorithm from qgis.core import QgsApplication, QgsSettings, QgsProcessingModelAlgorithm


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


pluginPath = os.path.split(os.path.dirname(__file__))[0] pluginPath = os.path.split(os.path.dirname(__file__))[0]
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/modeler/ModelerAlgorithmProvider.py
Expand Up @@ -47,7 +47,7 @@
from processing.modeler.DeleteModelAction import DeleteModelAction from processing.modeler.DeleteModelAction import DeleteModelAction
from processing.modeler.EditModelAction import EditModelAction from processing.modeler.EditModelAction import EditModelAction
from processing.modeler.OpenModelFromFileAction import OpenModelFromFileAction from processing.modeler.OpenModelFromFileAction import OpenModelFromFileAction
from processing.modeler.WrongModelException import WrongModelException from processing.modeler.exceptions import WrongModelException
from processing.modeler.ModelerUtils import ModelerUtils from processing.modeler.ModelerUtils import ModelerUtils


pluginPath = os.path.split(os.path.dirname(__file__))[0] pluginPath = os.path.split(os.path.dirname(__file__))[0]
Expand Down Expand Up @@ -127,5 +127,5 @@ def loadFromFolder(self, folder):
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile), QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
self.tr('Processing'), Qgis.Critical) self.tr('Processing'), Qgis.Critical)
except WrongModelException as e: except WrongModelException as e:
QgsMessageLog.logMessage(self.tr('Could not load model {0}\n{1}', 'ModelerAlgorithmProvider').format(descriptionFile, e.msg), QgsMessageLog.logMessage(self.tr('Could not load model {0}\n{1}', 'ModelerAlgorithmProvider').format(descriptionFile, str(e)),
self.tr('Processing'), Qgis.Critical) self.tr('Processing'), Qgis.Critical)
Expand Up @@ -2,11 +2,11 @@


""" """
*************************************************************************** ***************************************************************************
WrongModelException.py exceptions.py
--------------------- ---------------------
Date : August 2012 Date : March 2018
Copyright : (C) 2012 by Victor Olaya Copyright : (C) 2018 by Matthias Kuhn
Email : volayaf at gmail dot com Email : matthias@opengis.ch
*************************************************************************** ***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
Expand All @@ -17,17 +17,10 @@
*************************************************************************** ***************************************************************************
""" """


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'



class WrongModelException(Exception): class WrongModelException(Exception):
pass



def __init__(self, msg): class UndefinedParameterException(Exception):
Exception.__init__(self) pass
self.msg = msg

0 comments on commit 031aa9c

Please sign in to comment.