Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Catch more errors #135

Merged
merged 4 commits into from
Apr 13, 2023
Merged

Catch more errors #135

merged 4 commits into from
Apr 13, 2023

Conversation

akshualy
Copy link
Collaborator

Description

This PR adds changes that catch some new errors that may occur since we switched to HTTP requests.
We now also catch KeyboardInterrupt to correctly display that we know we should exit instead of printing a random stack trace.
In addition, a fix has been added to check if our session has expired.

Fixes #133
Fixes #134

Copy link
Owner

@Kyrluckechuck Kyrluckechuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one comment.

try:
sys.exit(main())
except KeyboardInterrupt:
logger.info("Received wish to exit by CTRL+C, exiting immediately.")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nice QoL thing might be to just do a final print_timer() -- what do you think? 😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, you'd probably not see that unless you're running from source. In addition, the "intended" way to exit is to enable the "stop queueing" logic, and then to Ctrl+C or close the window, which would print it twice :/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough -- I sometimes interrupt it mid-game and then surrender manually, so was thinking of that use case, but it's fairly minor 😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I think we can improve this catch to see from which logic step it was called, so maybe we can add it as a small improvement in another PR :)

tft.py Show resolved Hide resolved
@Kyrluckechuck Kyrluckechuck merged commit c187c1a into main Apr 13, 2023
@Kyrluckechuck Kyrluckechuck deleted the Catch-More-Errors branch April 13, 2023 00:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Session Has Expired Is Not Dismissed Write Wrapper Around Request Methods To Catch Various Errors
2 participants