-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes some error handling when unexpected input is given #4
Fixes some error handling when unexpected input is given #4
Conversation
Ayyy Phil We dig it––thanks for catching the issue and implementing the "quit search" feature, which we've wanted to implement but haven't gotten around to doing. We'll test your code and get back to you, hopefully later today! Thanks for the pull request, |
printQuestion(questions[j], j+1) | ||
continue #exit the inner while loop | ||
except: | ||
if (userInput != 'q'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The userInput == 'q'
case is handled above, in line 44––is there a reason for this redundancy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you throw the exception after the check, it automatically propagates to the except:
block. So when letting the user know what happened, you need to check if the exception occured because of q
, if it didn't then let the user know why. If it did then just exit as normal.
…invalid number is entered.
I also added similar checking for Also give a meaningful message on why nothing happens when an integer out of the range of Let me know if you have anymore concerns. Thanks, Phil |
@schwartzmx our first pull request is now merged! For now, you will be listed in README.md as Phil, with a link to your Github profile––let me know if you want me to display any more//less information. Thanks for working with us! |
@lukasschwab No problem man, and what a great idea you all came up with. As I use it more and find other features that may be useful I won't hesitate to open another PR. Edit: And thats fine for the Cheers, have a good night. Phil |
The current
stackit
, throws some nasty stack trace if invalid input is given after searching for a question. See:I altered some wording, and also added some error catching to make it not spit out the stack trace. Also added
q
option for quitting a search.Comments or concerns let me know.
Thanks,
Phil