Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Get Error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Feb 2, 2017
1 parent 6029f1e commit b5ddd62
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion filters/wpsFilter.py
Expand Up @@ -38,6 +38,15 @@
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.parameters import *
from processing.tools.general import *
from processing.gui.SilentProgress import SilentProgress

class QGISProgress(SilentProgress):

def __init__(self, algname=None):
self.msg = []

def error(self, msg):
self.msg.append(msg)

def QGISProcessFactory(alg_name, project='', vectors=[], rasters=[], crss=[]):
"""This is the bridge between SEXTANTE and PyWPS:
Expand Down Expand Up @@ -427,10 +436,13 @@ def execute(self):
if not len( self.alg.parameters ):
self.alg.defineCharacteristics()

tAlg = Processing.runAlgorithm(self.alg, None, args)
progress = QGISProgress()
tAlg = Processing.runAlgorithm(self.alg, None, args, progress=progress)
# if runalg failed return exception message
if not tAlg:
return 'Error in processing'
if len(progress.msg):
return ', '.join(progress.msg)
# clear map layer registry
mlr.removeAllMapLayers()
# get result
Expand Down

0 comments on commit b5ddd62

Please sign in to comment.