diff --git a/include/aidge/utils/Registrar.hpp b/include/aidge/utils/Registrar.hpp index a2f33eea5567ba2fcd1a741760332d3c927fbca1..a9368ecaf465f95b88812e1cef95dce705479376 100644 --- a/include/aidge/utils/Registrar.hpp +++ b/include/aidge/utils/Registrar.hpp @@ -76,16 +76,12 @@ struct Registrar { } static auto create(const registrar_key& key) { - if (!exists(key)) { - Log::error("missing or invalid registrar key: {} for registrable object {}\nDid you include/import the corresponding module?\nIf so, it is possible that the object is not yet supported.", key, typeid(C).name()); - - Log::info("Available registrar keys are:"); - for(const auto& keyValue : C::registry()) { - Log::info("- {}", keyValue.first); - } - - AIDGE_THROW_OR_ABORT(std::runtime_error, "missing or invalid registrar key"); - } + AIDGE_ASSERT(exists(key), + "missing or invalid registrar key: {} for registrable object {}\n" + "Did you include/import the corresponding module?\n" + "If so, it is possible that the object is not yet supported.\n\n" + "Available registrar keys are:\n {}", + key, typeid(C).name(), fmt::join(getKeys(), "\n ")); return C::registry().at(key); }