ci: Catch std::exception on toml::parse_file

This commit is contained in:
Nick Bolton 2024-10-18 20:39:23 +01:00
parent 9c9feba565
commit a32463586c
2 changed files with 3 additions and 4 deletions

View file

@ -67,6 +67,9 @@ bool Config::load(const std::string &firstArg)
} catch (const toml::parse_error &err) { } catch (const toml::parse_error &err) {
LOG((CLOG_ERR "toml parse error: %s", err.what())); LOG((CLOG_ERR "toml parse error: %s", err.what()));
throw ParseError(); throw ParseError();
} catch (const std::exception &err) {
LOG((CLOG_ERR "unknown parse error: %s", err.what()));
throw ParseError();
} }
if (!configTable.contains(m_section)) { if (!configTable.contains(m_section)) {

View file

@ -62,9 +62,6 @@ TEST(ConfigTests, load_fileDoesNotExist_returnsFalse)
ASSERT_FALSE(result); ASSERT_FALSE(result);
} }
// HACK: Disable on FreeBSD, because of error:
// "Error while parsing key-value pair: encountered end-of-file".
#if !defined(__FreeBSD__)
TEST(ConfigTests, load_invalidConfig_throwsException) TEST(ConfigTests, load_invalidConfig_throwsException)
{ {
EXPECT_THROW( EXPECT_THROW(
@ -80,7 +77,6 @@ TEST(ConfigTests, load_invalidConfig_throwsException)
Config::ParseError Config::ParseError
); );
} }
#endif
TEST(ConfigTests, load_sectionMissing_returnsFalse) TEST(ConfigTests, load_sectionMissing_returnsFalse)
{ {