Main: catch errors
This commit is contained in:
parent
51662cea3e
commit
a57b759af9
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user