community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1727669 - /comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py
Date Sat, 30 Jan 2016 00:26:26 GMT
Author: sebb
Date: Sat Jan 30 00:26:26 2016
New Revision: 1727669

URL: http://svn.apache.org/viewvc?rev=1727669&view=rev
Log:
Add debug if file content is not valid json (e.g. proxy error)

Modified:
    comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py

Modified: comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py?rev=1727669&r1=1727668&r2=1727669&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/parsecommitters.py Sat Jan 30 00:26:26 2016
@@ -31,8 +31,16 @@ uc = UrlCache(interval=0)
 def loadJson(url):
     print("Reading " +url)
     resp = uc.get(url, name=None, encoding='utf-8', errors=None)
-    j = json.load(resp)
-    resp.close()
+    try:
+        content = resp.read() # json.load() does this anyway
+        try:
+            j = json.loads(content)
+        except Exception as e:
+            # The Proxy error response is around 4800 bytes
+            print("Error parsing response:\n%s" % content[0:4800])
+            raise e
+    finally:
+        resp.close()
     return j
 
 people = {} # key: availid, value: array of groups to which the id belongs



Mime
View raw message