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

[tor-commits] [oonib/master] Handle writing exceptions that don't have log_exception attribute



commit 168a7c9b9f5c0699009d8ef6eea0078c2a6a19cc
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Apr 21 19:37:10 2014 +0200

    Handle writing exceptions that don't have log_exception attribute
---
 oonib/handlers.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/oonib/handlers.py b/oonib/handlers.py
index 2231a2a..20c831b 100644
--- a/oonib/handlers.py
+++ b/oonib/handlers.py
@@ -6,8 +6,10 @@ from cyclone import web
 class OONIBHandler(web.RequestHandler):
     def write_error(self, status_code, exception=None, **kw):
         self.set_status(status_code)
-        if exception:
+        if hasattr(exception, 'log_message'):
             self.write({'error': exception.log_message})
+        else:
+            self.write({'error': 'error'})
 
     def write(self, chunk):
         """



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