From 85c6fc82c77d4536db41921cd4c53ed0fd77871b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 13 Jun 2019 16:25:17 -0600 Subject: [PATCH] ircd::m::init: Add optional module list to prevent error propagation. --- ircd/m.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ircd/m.cc b/ircd/m.cc index 4391b5d5e..17799df85 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -110,6 +110,7 @@ ircd::m::init::close() namespace ircd::m { extern const std::vector module_names; + extern const std::vector module_names_optional; } ircd::m::init::modules::modules() @@ -155,8 +156,18 @@ ircd::m::init::modules::init_imports() return; } - for(const auto &name : module_name_list) + for(const auto &name : module_names) try + { mods::imports.emplace(name, name); + } + catch(...) + { + const auto &optional(module_names_optional); + if(std::count(begin(optional), end(optional), name)) + continue; + + throw; + } if(db::sequence(*dbs::events) == 0) bootstrap(); @@ -291,6 +302,14 @@ ircd::m::module_names "webroot", }; +/// This is a list of modules that are considered "optional" and any loading +/// error for them will not propagate and interrupt m::init. +decltype(ircd::m::module_names_optional) +ircd::m::module_names_optional +{ + "media_magick", +}; + void ircd::m::init::bootstrap() {