From ebfda949ea81ca7590c9cf65fdfeac59bce74636 Mon Sep 17 00:00:00 2001 From: Love Billenius Date: Fri, 24 Jan 2025 13:00:30 +0100 Subject: [PATCH] Catch no number exception --- src/Tui.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Tui.cpp b/src/Tui.cpp index 7d9de07..855f52a 100644 --- a/src/Tui.cpp +++ b/src/Tui.cpp @@ -54,7 +54,14 @@ void Tui::run() { for (;;) { std::cout << "Enter a command: "; std::flush(std::cout); - const Command::Command command = Command::readCommand(); + Command::Command command; + try { + command = Command::readCommand(); + } catch (const Command::NoNumberException &e) { + std::cout << e.what() << std::endl; + continue; + } + bool should_exit = false; auto visitor = [this, &should_exit](T0 &&arg) {