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

Catch KeyboardInterrupt exceptions gracefully #59

Closed
falkecarlsen opened this issue Dec 12, 2019 · 0 comments · Fixed by #60
Closed

Catch KeyboardInterrupt exceptions gracefully #59

falkecarlsen opened this issue Dec 12, 2019 · 0 comments · Fixed by #60
Labels
bug Something isn't working priority: medium Medium priority addition
Milestone

Comments

@falkecarlsen
Copy link
Collaborator

When prompting for custom input a ctrl + c will print a stacktrace from the line of the input function call.

user@thinktop ~> spotirec -gc
OAuth token is expired, refreshing...
Did not receive new refresh token, saving old
0: hip-hop                                 1: pop                                     2: disco
3: soul                                    4: indie-pop                               5: rock
6: electro                                 7: edm
Enter integer identifiers for 1-5 whitespace separated selections that you wish to include [default: top 5]:
^CTraceback (most recent call last):
  File "/usr/bin/spotirec", line 727, in <module>
    parse()
  File "/usr/bin/spotirec", line 694, in parse
    print_choices(data=get_user_top_genres(), sort=True)
  File "/usr/bin/spotirec", line 194, in print_choices
    input_string = input('Enter integer identifiers for 1-5 whitespace separated selections that you wish to '
KeyboardInterrupt

Catching this exception and simply exiting with a non-zero should suffice.

@Badgie Badgie added bug Something isn't working priority: medium Medium priority addition labels Mar 1, 2020
@Badgie Badgie added this to the v1.2 milestone Mar 7, 2020
@Badgie Badgie closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: medium Medium priority addition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants