code-questions-bot
code-questions-bot copied to clipboard
Add Exception Handling
Need to add exception handling to tweet.py
try:
api.update_status(question)
except:
# not sure what would go here?
finally:
api.update_status('I seem to not be working properly. Bug @Vicki_Langer about getting me fixed or help her out by submitting a pull request https://github.com/VickiLanger/code-questions-bot')
Don't forget to follow the bot on Twitter to see the hard work you put in.
@VickiLanger we can send a report email in case of exception, and keep on restarting the server after a configurable amount of time.
@sroy8091 Yes, an email would work. That makes sense. I don't see why we couldn't restart the server until it works.
@achoudh5 that seems like it would make sense. Honestly, I have not done any exception handling outside of some practice. So, I'm not sure what it normally looks like.
If I may ask, what I understood by tweet.py
and this error handling case is that after making sure the user enters their credentials right, it's taking some questions from a pool of questions and putting them as tweet right?
Yes. tweet.py
uses questions from files in questions_dir
Awesome! so, can we use an edge case file like if a user sends an empty
tweet or some tweets they wants to avoid but since it's automated they don't have any control over it?
Yes. That makes sense. An empty tweet definitely shouldn't happen.
Is that the only case you want to consider for now? I can create a PR for that if it's fine
That's the only thing I can think of. Go for it