Permalink
Browse files

Fail gracefully (silently) when account doesn't exist on enflair.

  • Loading branch information...
1 parent 8c107a3 commit e8c0edef41005111e6e4384cb41974f0b2d3c02e @spladug spladug committed Jun 26, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 scripts/enflair.py
View
8 scripts/enflair.py
@@ -1,10 +1,14 @@
#!/usr/bin/python
-from r2.models import Account, Subreddit
+from r2.models import Account, Subreddit, NotFound
def enflair(subreddit_name, account_name, flair_text, flair_class):
sr = Subreddit._by_name(subreddit_name)
- account = Account._by_name(account_name)
+
+ try:
+ account = Account._by_name(account_name)
+ except NotFound:
+ return
sr.add_flair(account)

0 comments on commit e8c0ede

Please sign in to comment.