Pārlūkot izejas kodu

Merge pull request #1616 from afishbeck/error_msg

Improve ecl command line error reporting

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 gadi atpakaļ
vecāks
revīzija
6b44400d07

+ 7 - 0
ecl/eclcmd/eclcmd_common.cpp

@@ -284,6 +284,13 @@ bool EclCmdCommon::finalizeOptions(IProperties *globals)
     extractEclCmdOption(optPort, globals, ECLOPT_PORT_ENV, ECLOPT_PORT_INI, ECLOPT_PORT_DEFAULT, NULL);
     extractEclCmdOption(optUsername, globals, ECLOPT_USERNAME_ENV, ECLOPT_USERNAME_INI, NULL, NULL);
     extractEclCmdOption(optPassword, globals, ECLOPT_PASSWORD_ENV, ECLOPT_PASSWORD_INI, NULL, NULL);
+
+    if (!optVerbose)
+    {
+        Owned<ILogMsgFilter> filter = getCategoryLogMsgFilter(MSGAUD_user, MSGCLS_error);
+        queryLogMsgManager()->changeMonitorFilter(queryStderrLogMsgHandler(), filter);
+    }
+
     return true;
 }
 

+ 1 - 1
ecl/eclcmd/eclcmd_shell.cpp

@@ -128,7 +128,7 @@ int EclCMDShell::run()
     }
     catch (IException *E)
     {
-        StringBuffer m("Error: ");
+        StringBuffer m;
         fputs(E->errorMessage(m).newline().str(), stderr);
         E->Release();
         return 2;

+ 3 - 2
esp/bindings/SOAP/client/soapclient.cpp

@@ -190,8 +190,9 @@ int CSoapClient::postRequest(const char* contenttype, const char* soapaction, IR
         else if(retstatus == SOAP_AUTHENTICATION_ERROR)
             errmsg = "SOAP authentication error";
 
-        if (soap_response->get_err())
-            errmsg.appendf("[%s]", soap_response->get_err());
+        const char *errText = soap_response->get_err();
+        if (errText && *errText)
+            errmsg.appendf("[%s]", errText);
 
         throw MakeStringException(retstatus, "%s", errmsg.str());
     }

+ 6 - 9
esp/bindings/http/client/httpclient.cpp

@@ -250,22 +250,19 @@ int CHttpClient::connect(StringBuffer& errmsg)
             }
         }
     }
-    catch(IException *excpt)
+    catch(IException *e)
     {
-        StringBuffer errMsg;
-        errmsg.appendf("Exception in CHttpClient::connect... %d==>%s", excpt->errorCode(), excpt->errorMessage(errMsg).str());
-        DBGLOG("%s", errmsg.str());
         StringBuffer url;
-        ERRLOG("Connect to %s failed: %s", ep.getUrlStr(url).str(),errMsg.str());
-        excpt->Release();
+        ERRLOG("Error connecting to %s", ep.getUrlStr(url).str());
+        DBGLOG(e);
+        e->Release();
         m_socket = NULL;
         return -1;
     }
     catch(...)
     {
-        DBGLOG(">>Exception in CHttpClient::connect...");
-        errmsg.appendf("Internal error: unexpected exception in CHttpClient::connect()");
-        ERRLOG("%s", errmsg.str());
+        StringBuffer url;
+        ERRLOG("Unknown exception connecting to %s", ep.getUrlStr(url).str());
         m_socket = NULL;
         return -1;
     }