bakaid commented on a change in pull request #706: MINIFICPP-1116 - Fix error reporting in C2Agent URL: https://github.com/apache/nifi-minifi-cpp/pull/706#discussion_r364713372
########## File path: libminifi/src/c2/C2Agent.cpp ########## @@ -154,25 +155,24 @@ void C2Agent::configure(const std::shared_ptr<Configure> &configure, bool reconf clazz = "CoapProtocol"; } logger_->log_info("Class is %s", clazz); - auto protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw(clazz, clazz); + auto protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw(clazz, clazz); if (protocol == nullptr) { - logger_->log_info("Class %s not found", clazz); + logger_->log_warn("Class %s not found", clazz); protocol = core::ClassLoader::getDefaultClassLoader().instantiateRaw("CoapProtocol", "CoapProtocol"); if (!protocol) { - logger_->log_info("Attempted to load CoapProtocol. To enable C2, please specify an active protocol for this agent."); - return; - } else { - logger_->log_info("Class is CoapProtocol"); + const char* errmsg = "Attempted to load CoapProtocol. To enable C2, please specify an active protocol for this agent."; + logger_->log_error(errmsg); + throw std::domain_error{ errmsg }; Review comment: I think it would be better to use a minifi::Exception here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services