[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] write failure instances to report



commit b9f52b03465e5f2a68b66b220d3c3d609fb8e456
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Fri Jan 25 21:12:23 2013 +0000

    write failure instances to report
---
 ooni/reporter.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ooni/reporter.py b/ooni/reporter.py
index 23cca69..638df41 100644
--- a/ooni/reporter.py
+++ b/ooni/reporter.py
@@ -16,6 +16,7 @@ from twisted.python.util import untilConcludes
 from twisted.trial import reporter
 from twisted.internet import defer, reactor
 from twisted.internet.error import ConnectionRefusedError
+from twisted.python.failure import Failure
 
 from ooni.utils import log
 
@@ -201,10 +202,12 @@ class YAMLReporter(OReporter):
         untilConcludes(self._stream.flush)
 
     def writeReportEntry(self, entry):
-        #XXX: all _write, _writeln inside this call should be atomic
         log.debug("Writing report with YAML reporter")
         self._write('---\n')
-        self._write(safe_dump(entry))
+        if isinstance(entry, Failure):
+            self._write(entry.value)
+        else:
+            self._write(safe_dump(entry))
         self._write('...\n')
 
     def createReport(self):
@@ -374,7 +377,7 @@ class Report(object):
         self.reporters = reporters
 
         self.done = defer.Deferred()
-        self.done.addCallback(self.close)
+        #self.done.addCallback(self.close)
 
         self.reportEntryManager = reportEntryManager
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits