Show error message instead of 500 when reddit is unavailable

This commit is contained in:
2010-05-16 18:32:31 +01:00
parent 999c642dbe
commit fc0dfd8f2c
2 changed files with 9 additions and 1 deletions

View File

@@ -70,7 +70,12 @@ def view_application(request, applicationid):
posts = []
for acc in redditacc:
posts.extend(acc.recent_posts())
try:
accposts = acc.recent_posts()
except:
reddit_error = "Encountered a error while trying to get all Reddit posts"
accposts = []
posts.extend(accposts)
return render_to_response('hr/applications/view.html', locals(), context_instance=RequestContext(request))