# HG changeset patch # User Sylvain Thénault # Date 1309443997 -7200 # Node ID a9aad6c25836ef0884fee62d96c692d9b65ccc2d # Parent 7588240bcb367b2e14f396929f65963c6474461c closes #1793991: [datafeed] error handling: log unexpected exceptions / don't stop on first validation error diff -r 7588240bcb36 -r a9aad6c25836 server/sources/datafeed.py --- a/server/sources/datafeed.py Thu Jun 30 13:38:30 2011 +0200 +++ b/server/sources/datafeed.py Thu Jun 30 16:26:37 2011 +0200 @@ -192,12 +192,18 @@ try: if parser.process(url, raise_on_error): error = True - except Exception, exc: + except IOError, exc: if raise_on_error: raise self.error('could not pull data while processing %s: %s', url, exc) error = True + except Exception, exc: + if raise_on_error: + raise + self.exception('error while processing %s: %s', + url, exc) + error = True return error def before_entity_insertion(self, session, lid, etype, eid, sourceparams): @@ -266,8 +272,12 @@ source = self._cw.repo.sources_by_uri.get( sourceparams.pop('cwsource', None), self.source) sourceparams['parser'] = self - eid = source.extid2eid(str(uri), etype, self._cw, - sourceparams=sourceparams) + try: + eid = source.extid2eid(str(uri), etype, self._cw, + sourceparams=sourceparams) + except ValidationError, ex: + self.source.error('error while creating %s: %s', etype, ex) + return None if eid < 0: # entity has been moved away from its original source #