code-questions-bot icon indicating copy to clipboard operation
code-questions-bot copied to clipboard

Add Exception Handling

Open VickiLanger opened this issue 5 years ago • 10 comments

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 avatar Jan 27 '20 22:01 VickiLanger

@VickiLanger we can send a report email in case of exception, and keep on restarting the server after a configurable amount of time.

sroy8091 avatar Oct 01 '20 22:10 sroy8091

@sroy8091 Yes, an email would work. That makes sense. I don't see why we couldn't restart the server until it works.

VickiLanger avatar Oct 04 '20 01:10 VickiLanger

@VickiLanger can we put the specific status code under except part?

Reference

achoudh5 avatar Oct 04 '20 03:10 achoudh5

@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.

VickiLanger avatar Oct 04 '20 03:10 VickiLanger

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?

achoudh5 avatar Oct 04 '20 03:10 achoudh5

Yes. tweet.py uses questions from files in questions_dir

VickiLanger avatar Oct 04 '20 03:10 VickiLanger

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?

achoudh5 avatar Oct 04 '20 03:10 achoudh5

Yes. That makes sense. An empty tweet definitely shouldn't happen.

VickiLanger avatar Oct 04 '20 03:10 VickiLanger

Is that the only case you want to consider for now? I can create a PR for that if it's fine

achoudh5 avatar Oct 04 '20 03:10 achoudh5

That's the only thing I can think of. Go for it

VickiLanger avatar Oct 04 '20 03:10 VickiLanger