Main: catch errors

This commit is contained in:
augustin64 2023-11-15 15:44:42 +01:00
parent 51662cea3e
commit a57b759af9

View File

@ -36,10 +36,18 @@ int main(int argc, char* argv[]) {
EvalResult res = eval(ast);
cout << get<int>(res) << endl;
} catch (const TokenError& e) {
pretty_print_error(input, e.pos);
cout << BOLD RED "Token Error: " RESET << e.what() << endl;
} catch (const SyntaxError& e) {
pretty_print_error(input, e.pos);
cout << BOLD RED "Syntax Error: " RESET << e.what() << endl;
} catch (const RuntimeError& e) {
pretty_print_error(input, e.pos);
cout << BOLD RED "Runtime Error: " RESET << e.what() << endl;
} catch (const ParseException& e) {
cout << RED "ParsingError" RESET << endl;
}