Skip to content

Commit

Permalink
Merge pull request #23 from cwood/dev
Browse files Browse the repository at this point in the history
Better handling for not connecting or json decode error
  • Loading branch information
coagulant committed Feb 18, 2013
2 parents 59ba3b2 + 7b0dfe3 commit 0a6ef2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion twitter_tag/templatetags/twitter_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from ..utils import expand_tweet_urls, urlize_twitter_text, get_user_cache_key, get_search_cache_key

from urllib2 import URLError

register = template.Library()

Expand Down Expand Up @@ -46,7 +47,7 @@ def render_tag(self, context, **kwargs):
settings.TWITTER_CONSUMER_KEY,
settings.TWITTER_CONSUMER_SECRET))
json = self.get_json(twitter, **self.get_api_call_params(**kwargs))
except TwitterError as e:
except (TwitterError, URLError, ValueError) as e:
logging.getLogger(__name__).error(str(e))
context[kwargs['asvar']] = cache.get(cache_key, [])
return ''
Expand Down

0 comments on commit 0a6ef2a

Please sign in to comment.