mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Show error message instead of 500 when reddit is unavailable
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@
|
||||
|
||||
<h3>Reddit Posts</h3>
|
||||
<ul>
|
||||
{% if reddit_error %}
|
||||
<p><b>{{ reddit_error }}</b></p>
|
||||
{% endif %}
|
||||
{% for post in posts %}
|
||||
{% ifnotequal post.kind 1 %}
|
||||
<p><b><a href="http://reddit.com{{ post.permalink }}">{{ post.title }}</a></b> - (/r/{{ post.subreddit }})</p>
|
||||
|
||||
Reference in New Issue
Block a user