Skip to content

Commit

Permalink
Raise internal error if algorithm execution exception is not GeoAEE.
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@347 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Aug 13, 2012
1 parent cf2fca0 commit 0a29cc0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/sextante/core/Sextante.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def runAlgorithm(algOrName, onFinish, *args):
SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())

QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS) and onFinish:
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS):
algEx = AlgorithmExecutor(alg)
progress = QProgressDialog()
progress.setWindowTitle(alg.name)
Expand Down
16 changes: 11 additions & 5 deletions src/sextante/gui/AlgorithmExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AlgorithmExecutor(QThread):
percentageChanged = pyqtSignal(int)
textChanged = pyqtSignal(QString)
error = pyqtSignal(str)
internalError = pyqtSignal(BaseException)
iterated = pyqtSignal(int)
infoSet = pyqtSignal(str)
commandSet = pyqtSignal(str)
Expand Down Expand Up @@ -59,19 +60,24 @@ def setConsoleInfo(self, info):
del writer
else:
self.run = self.runalg
self.internalError.connect(self.raiseInternalError)

def raiseInternalError(self, error):
raise error

def runalg(self):
try:
self.algorithm.execute(self.progress)
except GeoAlgorithmExecutionException,e :
except GeoAlgorithmExecutionException as e :
self.error.emit(e.msg)
except Exception,e:
self.error.emit(str(e))
print str(e)
except BaseException as e:
self.internalError.emit(e)
# catch *all* errors, because QGIS tries to handle them in the GUI, which is fatal, this
# being a separate thread.
except:
self.error.emit("Error executing " + str(self.alg.name) + "\n" + sys.exc_info()[0])
msg = "Error executing " + str(self.alg.name) + "\n" + sys.exc_info()[0]
print msg
self.internalError.emit(msg)

def runalgIterating(self):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/tests/runtests.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
QGISPATH=/usr/local PYTHONPATH=~/Proyectos/qgis/output/python/:~/Proyectos/qgis/python/plugins/ python test.py $@
QGISPATH=/usr/local PYTHONPATH=~/Proyectos/qgis/python/plugins/:~/Proyectos/qgis/output/python/ python test.py $@

0 comments on commit 0a29cc0

Please sign in to comment.