Skip to content

Commit

Permalink
Better error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
smicallef committed Aug 11, 2015
1 parent e9f1ea9 commit 2192344
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion modules/sfp_coderepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def handleEvent(self, event):
self.sf.error("Unable to fetch " + url, False)
failed = True

ret = json.loads(res['content'])
try:
ret = json.loads(res['content'])
except BaseException as e:
ret = None

if ret == None:
self.sf.error("Unable to process empty response from Github for: " + \
name, False)
Expand Down
6 changes: 5 additions & 1 deletion modules/sfp_duckduckgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def handleEvent(self, event):
self.sf.error("Unable to fetch " + url, False)
return None

ret = json.loads(res['content'])
try:
ret = json.loads(res['content'])
except BaseException as e:
ret = None

if ret == None:
self.sf.error("Unable to process empty response from DuckDuckGo for: " + \
eventData, False)
Expand Down
6 changes: 5 additions & 1 deletion modules/sfp_historic.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def handleEvent(self, event):
self.sf.error("Unable to fetch " + url, False)
continue

ret = json.loads(res['content'])
try:
ret = json.loads(res['content'])
except BaseException as e:
ret = None

if ret == None:
self.sf.error("Unable to process empty response from archive.org: " + \
eventData, False)
Expand Down

0 comments on commit 2192344

Please sign in to comment.