Skip to content

Commit 0a29cc0

Browse files
author
cpolymeris@gmail.com
committedAug 13, 2012
Raise internal error if algorithm execution exception is not GeoAEE.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@347 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent cf2fca0 commit 0a29cc0

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed
 

‎src/sextante/core/Sextante.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def runAlgorithm(algOrName, onFinish, *args):
293293
SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())
294294

295295
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
296-
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS) and onFinish:
296+
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS):
297297
algEx = AlgorithmExecutor(alg)
298298
progress = QProgressDialog()
299299
progress.setWindowTitle(alg.name)

‎src/sextante/gui/AlgorithmExecutor.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class AlgorithmExecutor(QThread):
1010
percentageChanged = pyqtSignal(int)
1111
textChanged = pyqtSignal(QString)
1212
error = pyqtSignal(str)
13+
internalError = pyqtSignal(BaseException)
1314
iterated = pyqtSignal(int)
1415
infoSet = pyqtSignal(str)
1516
commandSet = pyqtSignal(str)
@@ -59,19 +60,24 @@ def setConsoleInfo(self, info):
5960
del writer
6061
else:
6162
self.run = self.runalg
63+
self.internalError.connect(self.raiseInternalError)
64+
65+
def raiseInternalError(self, error):
66+
raise error
6267

6368
def runalg(self):
6469
try:
6570
self.algorithm.execute(self.progress)
66-
except GeoAlgorithmExecutionException,e :
71+
except GeoAlgorithmExecutionException as e :
6772
self.error.emit(e.msg)
68-
except Exception,e:
69-
self.error.emit(str(e))
70-
print str(e)
73+
except BaseException as e:
74+
self.internalError.emit(e)
7175
# catch *all* errors, because QGIS tries to handle them in the GUI, which is fatal, this
7276
# being a separate thread.
7377
except:
74-
self.error.emit("Error executing " + str(self.alg.name) + "\n" + sys.exc_info()[0])
78+
msg = "Error executing " + str(self.alg.name) + "\n" + sys.exc_info()[0]
79+
print msg
80+
self.internalError.emit(msg)
7581

7682
def runalgIterating(self):
7783
try:

‎src/sextante/tests/runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
QGISPATH=/usr/local PYTHONPATH=~/Proyectos/qgis/output/python/:~/Proyectos/qgis/python/plugins/ python test.py $@
1+
QGISPATH=/usr/local PYTHONPATH=~/Proyectos/qgis/python/plugins/:~/Proyectos/qgis/output/python/ python test.py $@

0 commit comments

Comments
 (0)
Please sign in to comment.