Skip to content
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

Handle exceptions in ask #34

Merged
merged 3 commits into from
Jan 10, 2020
Merged

Handle exceptions in ask #34

merged 3 commits into from
Jan 10, 2020

Conversation

omrisarig13
Copy link
Owner

@omrisarig13 omrisarig13 commented Jan 10, 2020

Fixes #32

Add a new module with a single method that implements an action that can
get a string safely from the user.

This method will try to run the given ask method until it will get
a value back from the user. In case the method will raise the exception
of UnicodeDecodeError (which happens when the input is invalid), the
command will ignore the input from the user and try to get a new one
from it.

This commit was done as part of issue #32
This commit moves over all the places in the code with a call to ask_str
and changes them to be using safe_ask with the ask_str there
instead. This makes the calling to this function safe, and make sure
that the program won't crush when it is used.

This was done as part of issue #32
This commit moves over all the places in the code with a call to ask_int
and changes them to be using safe_ask with the ask_int there
instead. This makes the calling to this function safe, and make sure
that the program won't crush when it is used.

This was done as part of issue #32
@omrisarig13 omrisarig13 merged commit edc0b16 into master Jan 10, 2020
@omrisarig13 omrisarig13 deleted the handle_exceptions_in_ask branch January 10, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python - Handle errors in ask methods
1 participant