Skip to content

Commit 2ef8baf

Browse files
Merge pull request #146 from ankit167/Exception_Handling_in_tweeter.py
Exception Handling in tweeter.py
2 parents c0ce6f4 + d553391 commit 2ef8baf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tweeter.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ def tweetthis(type):
1212
if type == "text":
1313
print "Enter your tweet "+user.name
1414
tweet = raw_input()
15-
api.update_status(tweet)
15+
try:
16+
api.update_status(tweet)
17+
except Exception as e:
18+
print e
19+
return
1620
elif type == "pic":
1721
print "Enter pic path "+user.name
1822
pic = os.path.abspath(raw_input())
1923
print "Enter status "+user.name
2024
title = raw_input()
21-
api.update_with_media(pic, status=title)
25+
try:
26+
api.update_with_media(pic, status=title)
27+
except Exception as e:
28+
print e
29+
return
2230

2331
print "\n\nDONE!!"
2432

0 commit comments

Comments
 (0)