From ab2b24d98233bb858dd6b32acace8cdf8e8b0e78 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Fri, 18 Oct 2024 08:16:55 +0300 Subject: [PATCH] make generation.get_generators nothrow --- src/content/ContentLoader.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/content/ContentLoader.cpp b/src/content/ContentLoader.cpp index 7a772d84..df367b96 100644 --- a/src/content/ContentLoader.cpp +++ b/src/content/ContentLoader.cpp @@ -78,11 +78,15 @@ static void detect_defs_pairs( continue; } if (fs::is_regular_file(file) && files::is_data_file(file)) { - auto map = files::read_object(file); - std::string id = prefix.empty() ? name : prefix + ":" + name; - std::string caption = util::id_to_caption(id); - map.at("caption").get(caption); - detected.emplace_back(id, name); + try { + auto map = files::read_object(file); + auto id = prefix.empty() ? name : prefix + ":" + name; + auto caption = util::id_to_caption(id); + map.at("caption").get(caption); + detected.emplace_back(id, name); + } catch (const std::runtime_error& err) { + logger.error() << err.what(); + } } else if (fs::is_directory(file) && file.extension() != fs::u8path(".files")) { detect_defs_pairs(file, name, detected);