Add better error handling for curses failures

This commit is contained in:
noelle 2025-06-02 15:55:38 -04:00
parent db1464c2d2
commit a07aa2685b
Signed by: noelle
SSH Key Fingerprint: SHA256:30qkkOn+Czx9ud36Ekl0NB/y+W4c25oREt+qmasrU9w

View File

@ -345,5 +345,13 @@ train.insert(0,pad_str)
train.append(pad_str)
if __name__ == "__main__":
signal(SIGINT, handler)
curses.wrapper(chuggachugga)
signal(SIGINT, handler)
try:
curses.wrapper(chuggachugga)
except curses.error as err:
print(
f"{err}\n"
"Couldn't print the train for some reason. "
"Maybe your terminal window is too short?"
)
sys.exit(1)