diff --git a/engine/static/core/include/argus/core/engine.hpp b/engine/static/core/include/argus/core/engine.hpp index 6f6e3a0c..a8db490c 100644 --- a/engine/static/core/include/argus/core/engine.hpp +++ b/engine/static/core/include/argus/core/engine.hpp @@ -65,9 +65,6 @@ namespace argus { * * @attention This must be called before any other interaction with the * engine takes place. - * - * @throw std::invalid_argument If any of the requested modules (or their - * dependencies) cannot be loaded. */ void initialize_engine(void); diff --git a/engine/static/core/include/argus/core/module.hpp b/engine/static/core/include/argus/core/module.hpp index 64d36241..3f01a626 100644 --- a/engine/static/core/include/argus/core/module.hpp +++ b/engine/static/core/include/argus/core/module.hpp @@ -200,9 +200,6 @@ namespace argus { * * @attention For convenience, the macro REGISTER_ARGUS_MODULE registers an * entry point which invokes this function automatically. - * - * @throw std::invalid_argument If a module with the given ID is already - * registered. */ void register_dynamic_module(const std::string &id, LifecycleUpdateCallback lifecycle_callback, const std::vector& dependencies = {}); @@ -212,8 +209,7 @@ namespace argus { * * @param module_id The ID of the dynamic module to enable. * - * @throw std::invalid_argument If no dynamic module with the given ID is - * currently registered. + * @return Whether the module was successfully enabled. */ bool enable_dynamic_module(const std::string &module_id); diff --git a/engine/static/core/src/module.cpp b/engine/static/core/src/module.cpp index 8966636c..88c39957 100644 --- a/engine/static/core/src/module.cpp +++ b/engine/static/core/src/module.cpp @@ -293,7 +293,7 @@ namespace argus { if (dependent_chain.empty()) { Logger::default_logger().warn("Module \"%s\" requested more than once.", module_id.c_str()); } - return false; + return true; } } @@ -334,7 +334,7 @@ namespace argus { g_enabled_dyn_modules_staging.insert({ module_id, it->second }); - Logger::default_logger().info("Enabled dynamic module %s.", module_id.c_str()); + Logger::default_logger().info("Enabled dynamic module %s", module_id.c_str()); return true; } @@ -357,7 +357,9 @@ namespace argus { all_modules.insert({ found_static->id }); all_modules.insert(found_static->dependencies.begin(), found_static->dependencies.end()); } else { - enable_dynamic_module(module_id); + if (!enable_dynamic_module(module_id)) { + crash("Failed to load required module %s", module_id.c_str()); + } } }