feat: change to exception

This commit is contained in:
3lswear
2022-02-13 22:38:58 +03:00
parent e15ba8b041
commit 4be3ba3f9d

View File

@@ -68,16 +68,15 @@ namespace config
struct s_token Tokenizer::getToken(void) struct s_token Tokenizer::getToken(void)
{ {
char c;
struct s_token token; struct s_token token;
if (file.eof()) if (file.eof())
{ {
std::cout << "Tokens exhausted" << std::endl; DBOUT << RED << "Tokens exhausted" << ENDL;
throw std::logic_error("Tokens exhausted"); throw NoMoreTokens();
} }
prev_pos = file.tellg(); prev_pos = file.tellg();
c = getWithoutWhiteSpace(); char c = getWithoutWhiteSpace();
if (firstToken() && config::istomlkey(c)) if (firstToken() && config::istomlkey(c))
{ {