[datafeed log] properly log errors catched at the source level
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 09 Nov 2011 15:13:13 +0100
changeset 8069 4341fb713b14
parent 8068 72210779ff6d
child 8070 61fb207ad2d8
[datafeed log] properly log errors catched at the source level
server/sources/datafeed.py
--- a/server/sources/datafeed.py	Wed Nov 09 14:34:03 2011 +0100
+++ b/server/sources/datafeed.py	Wed Nov 09 15:13:13 2011 +0100
@@ -225,8 +225,9 @@
             except IOError, exc:
                 if raise_on_error:
                     raise
-                self.error('could not pull data while processing %s: %s',
-                           url, exc)
+                parser.import_log.record_error(
+                    'could not pull data while processing %s: %s'
+                    % (url, exc))
                 error = True
             except Exception, exc:
                 if raise_on_error:
@@ -320,6 +321,8 @@
             # XXX use critical so they are seen during tests. Should consider
             # raise_on_error instead?
             self.source.critical('error while creating %s: %s', etype, ex)
+            self.import_log.record_error('error while creating %s: %s'
+                                         % (etype, ex))
             return None
         if eid < 0:
             # entity has been moved away from its original source
@@ -365,7 +368,7 @@
         except Exception, ex:
             if raise_on_error:
                 raise
-            self.source.error(str(ex))
+            self.import_log.record_error(str(ex))
             return True
         error = False
         for args in parsed: