arpadboda commented on a change in pull request #610: MINIFICPP-814 - Fixed 
ListenHTTP and HTTPClient bugs, created tests f…
URL: https://github.com/apache/nifi-minifi-cpp/pull/610#discussion_r303788578
 
 

 ##########
 File path: extensions/civetweb/processors/ListenHTTP.h
 ##########
 @@ -163,10 +166,47 @@ class ListenHTTP : public core::Processor {
     const struct mg_request_info *req_info_;
   };
 
+  static int log_message(const struct mg_connection *conn, const char 
*message) {
+    try {
+      struct mg_context* ctx = mg_get_context(conn);
+      /* CivetServer stores 'this' as the userdata when calling mg_start */
+      CivetServer* server = static_cast<CivetServer*>(mg_get_user_data(ctx));
+      if (server == nullptr) {
+        return 0;
+      }
+      std::shared_ptr<logging::Logger>* logger = 
static_cast<std::shared_ptr<logging::Logger>*>(const_cast<void*>(server->getUserContext()));
+      if (logger == nullptr) {
+        return 0;
+      }
+      logging::LOG_ERROR((*logger)) << "CivetWeb error: " << message;
+    } catch (...) {
 
 Review comment:
   Why?
   Static cast doesn't throw, so unless our logger throws (which I can hardly 
imagine), I see no call here that might end up in an exception to handle. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to