diff --git a/src/Server/Server.cpp b/src/Server/Server.cpp index 745f012..af9b10d 100644 --- a/src/Server/Server.cpp +++ b/src/Server/Server.cpp @@ -36,8 +36,30 @@ void Server::print_epoll_events(unsigned int events) //----------------------------------------------Configuration----------------------------------------------------------------------------------- void Server::readConfig(char *filename) { - TOMLMap *root = parse(filename); + TOMLMap *root = NULL; + try + { + root = parse(filename); + } + catch (config::Tokenizer::NoMoreTokens &e) + { + std::cerr << RED << "FATAL: "; + std::cerr << e.what() << RESET << std::endl; + // root->clear(); + // delete root; + // clean_parsed(root); + return; + } + catch (config::Tokenizer::InvalidToken &e) + { + std::cerr << RED << "FATAL: "; + std::cerr << e.what() << RESET << std::endl; + // clean_parsed(root); + // root->clear(); + delete root; + return; + } /* TOMLMap *map; */ TOMLMap::iterator it1; @@ -408,9 +430,9 @@ void Server::clean_parsed(TOMLMap *root) DBOUT << ">>> cleaning up: <<<" << std::endl; for (it = root->begin(); it != root->end(); ++it) { - /* DBOUT << RED << it->first */ - /* << ": " << GREEN */ - /* << *(it->second->toString()); */ + DBOUT << RED << it->first + << ": " << GREEN + << *(it->second->toString()); clean_generic(it->second); /* delete it->second; */