🔨」 fix: fixed issue with exception not thrown properly

This commit is contained in:
2025-07-12 22:00:16 +02:00
parent 2973dfd0b7
commit 411eaa1999
3 changed files with 7 additions and 6 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */ /* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */
/* Updated: 2025/06/23 20:36:47 by adjoly ### ########.fr */ /* Updated: 2025/07/12 21:40:21 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -27,11 +27,12 @@ Config::Config(std::string &filename) {
try { try {
file->parse(); file->parse();
} catch (std::exception &e) { } catch (const std::exception &e) {
// if (file->getParsedFile() != not_nullptr) // if (file->getParsedFile() != not_nullptr)
// delete file->getParsedFile(); // delete file->getParsedFile();
std::runtime_error excep(e.what());
delete file; delete file;
throw e; throw excep;
} }
toml::ANode *table = file->getParsedFile(); toml::ANode *table = file->getParsedFile();

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */ /* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
/* Updated: 2025/06/23 20:35:27 by adjoly ### ########.fr */ /* Updated: 2025/07/12 21:38:36 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -70,7 +70,7 @@ int main(int ac, char **av) {
str = av[1]; str = av[1];
} }
config::_conf = new config::Config(str); config::_conf = new config::Config(str);
} catch (std::exception &e) { } catch (const std::exception &e) {
Logger log; Logger log;
log.error(e.what()); log.error(e.what());
if (_log != not_nullptr) if (_log != not_nullptr)