浏览代码

Bug: 83861 Add more debugging/postmortem information to ESP log

Existing ESP log contains a log line to trace ESP processing time
for each HTTP request. The code is modified to add more information
into the log line if there is an exception or the request takes a
long time to process. The information includes user (if available),
IP, and HTTP/SOAP request.

Signed-off-by: Kevin Wang <kevin.wang@lexisnexis.com>
Kevin Wang 14 年之前
父节点
当前提交
2101246a27

+ 2 - 0
esp/bindings/http/platform/httpbinding.cpp

@@ -584,6 +584,8 @@ bool EspHttpBinding::basicAuth(IEspContext* ctx)
         return authorized;
         return authorized;
 
 
     m_secmgr->updateSettings(*user,securitySettings);
     m_secmgr->updateSettings(*user,securitySettings);
+
+    ctx->addTraceSummaryTimeStamp("basicAuth");
     return authorized;
     return authorized;
 }
 }
     
     

+ 1 - 25
esp/bindings/http/platform/httpprot.cpp

@@ -423,31 +423,8 @@ CHttpThread::~CHttpThread()
 {
 {
 }
 }
 
 
-static atomic_t gActiveRequests;
-
-class ActiveRequests
-{
-public:
-    
-    ActiveRequests() { inc(); }
-    virtual ~ActiveRequests()  { dec(); }
-
-    void inc() 
-    {   
-        atomic_inc(&gActiveRequests);
-        DBGLOG("*** Active requests: %u ***", (int)atomic_read(&gActiveRequests)); 
-    }
-    
-    void dec() 
-    { 
-        atomic_dec(&gActiveRequests);
-        DBGLOG("*** Active requests: %u ***", (int)atomic_read(&gActiveRequests)); 
-    }
-};
-
 bool CHttpThread::onRequest()
 bool CHttpThread::onRequest()
 {
 {
-    EspTimeSection timing("CHttpThread::onRequest()");
     ActiveRequests recording;
     ActiveRequests recording;
 
 
     Owned<CEspHttpServer> httpserver;
     Owned<CEspHttpServer> httpserver;
@@ -491,8 +468,7 @@ bool CHttpThread::onRequest()
     time_t t = time(NULL);  
     time_t t = time(NULL);  
     initThreadLocal(sizeof(t), &t);
     initThreadLocal(sizeof(t), &t);
 
 
-    if (httpserver->processRequest()==-1)
-        timing.clear();
+    httpserver->processRequest();
     clearThreadLocal();
     clearThreadLocal();
     
     
     return false;
     return false;

+ 64 - 3
esp/bindings/http/platform/httpservice.cpp

@@ -27,6 +27,7 @@
 //Jlib
 //Jlib
 #include "jliball.hpp"
 #include "jliball.hpp"
 
 
+#include "espcontext.hpp"
 #include "esphttp.hpp"
 #include "esphttp.hpp"
 
 
 //ESP Bindings
 //ESP Bindings
@@ -35,16 +36,15 @@
 
 
 #include "htmlpage.hpp"
 #include "htmlpage.hpp"
 
 
-
 /***************************************************************************
 /***************************************************************************
  *              CEspHttpServer Implementation
  *              CEspHttpServer Implementation
  ***************************************************************************/
  ***************************************************************************/
 CEspHttpServer::CEspHttpServer(ISocket& sock, bool viewConfig, int maxRequestEntityLength):m_socket(sock), m_MaxRequestEntityLength(maxRequestEntityLength)
 CEspHttpServer::CEspHttpServer(ISocket& sock, bool viewConfig, int maxRequestEntityLength):m_socket(sock), m_MaxRequestEntityLength(maxRequestEntityLength)
 {
 {
+    IEspContext* ctx = createEspContext();
     m_request.setown(new CHttpRequest(sock));
     m_request.setown(new CHttpRequest(sock));
     m_request->setMaxRequestEntityLength(maxRequestEntityLength);
     m_request->setMaxRequestEntityLength(maxRequestEntityLength);
     m_response.setown(new CHttpResponse(sock));
     m_response.setown(new CHttpResponse(sock));
-    IEspContext* ctx = createEspContext();
     m_request->setOwnContext(ctx);
     m_request->setOwnContext(ctx);
     m_response->setOwnContext(LINK(ctx));
     m_response->setOwnContext(LINK(ctx));
     m_viewConfig=viewConfig;
     m_viewConfig=viewConfig;
@@ -52,10 +52,10 @@ CEspHttpServer::CEspHttpServer(ISocket& sock, bool viewConfig, int maxRequestEnt
 
 
 CEspHttpServer::CEspHttpServer(ISocket& sock, CEspApplicationPort* apport, bool viewConfig, int maxRequestEntityLength):m_socket(sock), m_MaxRequestEntityLength(maxRequestEntityLength)
 CEspHttpServer::CEspHttpServer(ISocket& sock, CEspApplicationPort* apport, bool viewConfig, int maxRequestEntityLength):m_socket(sock), m_MaxRequestEntityLength(maxRequestEntityLength)
 {
 {
+    IEspContext* ctx = createEspContext();
     m_request.setown(new CHttpRequest(sock));
     m_request.setown(new CHttpRequest(sock));
     m_request->setMaxRequestEntityLength(maxRequestEntityLength);
     m_request->setMaxRequestEntityLength(maxRequestEntityLength);
     m_response.setown(new CHttpResponse(sock));
     m_response.setown(new CHttpResponse(sock));
-    IEspContext* ctx = createEspContext();
     m_request->setOwnContext(ctx);
     m_request->setOwnContext(ctx);
     m_response->setOwnContext(LINK(ctx));
     m_response->setOwnContext(LINK(ctx));
     m_apport = apport;
     m_apport = apport;
@@ -68,6 +68,66 @@ CEspHttpServer::~CEspHttpServer()
 {
 {
     try
     try
     {
     {
+        IEspContext* ctx = m_request->queryContext();
+        if (ctx)
+        {
+            //Request is logged only when there is an exception or the request time is very long.
+            //If the flag of 'EspLogRequests' is set or the log level > LogNormal, the Request should
+            //has been logged and it should not be logged here.
+            ctx->setProcessingTime();
+            if ((ctx->queryHasException() || (ctx->queryProcessingTime() > getSlowProcessingTime())) &&
+                !getEspLogRequests() && (getEspLogLevel() <= LogNormal))
+            {
+                StringBuffer logStr;
+                logStr.appendf("%s %s", m_request->queryMethod(), m_request->queryPath());
+
+                const char* paramStr = m_request->queryParamStr();
+                if (paramStr && *paramStr)
+                    logStr.appendf("?%s", paramStr);
+
+                if (m_request->isSoapMessage())
+                {
+                    StringBuffer requestStr;
+                    m_request->getContent(requestStr);
+
+                    if (requestStr.length() > 0)
+                    {
+                        bool trimSpace = true;
+                        StringBuffer requestBuf;
+                        const char* s = requestStr.str();
+                        while (s && *s)
+                        {
+                            if ((s[0] != '\r') && (s[0] != '\n'))
+                            {
+                                if (s[0] != ' ')
+                                {
+                                    requestBuf.append(s[0]);
+                                    trimSpace = false;
+                                }
+                                else if (!trimSpace)
+                                {
+                                    requestBuf.append(s[0]);
+                                }
+                            }
+                            else
+                            {
+                                trimSpace = true;
+                            }
+
+                            s++;
+                        }
+
+                        if (requestBuf.length() > 0)
+                        {
+                            logStr.newline();
+                            logStr.append(requestBuf.str());
+                        }
+                    }
+                }
+                DBGLOG("Request[%s]", logStr.str());
+            }
+        }
+
         m_request.clear();
         m_request.clear();
         m_response.clear();
         m_response.clear();
     }
     }
@@ -402,6 +462,7 @@ int CEspHttpServer::processRequest()
                 else
                 else
                     unsupported();
                     unsupported();
             }
             }
+            ctx->addTraceSummaryTimeStamp("handleHttp");
         }
         }
     }
     }
     catch(IEspHttpException* e)
     catch(IEspHttpException* e)

+ 2 - 0
esp/bindings/http/platform/httptransport.cpp

@@ -498,6 +498,7 @@ int CHttpMessage::receive(bool alwaysReadContent, IMultiException *me)
     if (isUpload())
     if (isUpload())
         return 0;
         return 0;
 
 
+    m_context->addTraceSummaryValue("contLen", m_content_length);
     if(m_content_length > 0)
     if(m_content_length > 0)
     {
     {
         readContent();
         readContent();
@@ -1451,6 +1452,7 @@ int CHttpRequest::receive(IMultiException *me)
         }
         }
     }
     }
 
 
+    m_context->addTraceSummaryTimeStamp("rcv");
     return 0;
     return 0;
 }
 }
 
 

+ 1 - 0
esp/platform/espcfg.cpp

@@ -137,6 +137,7 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
     m_options.logReq = m_cfg->getPropBool("@logRequests", false);
     m_options.logReq = m_cfg->getPropBool("@logRequests", false);
     m_options.logResp = m_cfg->getPropBool("@logResponses", false);
     m_options.logResp = m_cfg->getPropBool("@logResponses", false);
     m_options.frameTitle.set(m_cfg->queryProp("@name"));
     m_options.frameTitle.set(m_cfg->queryProp("@name"));
+    m_options.slowProcessingTime = m_cfg->getPropInt("@slowProcessingTime", 30) * 1000; //in msec
 
 
 #ifdef USE_ENV_CONF_FILE
 #ifdef USE_ENV_CONF_FILE
     // load environment parameters
     // load environment parameters

+ 2 - 1
esp/platform/espcfg.ipp

@@ -91,8 +91,9 @@ struct esp_option
     bool logReq;
     bool logReq;
     bool logResp;
     bool logResp;
     StringAttr frameTitle;
     StringAttr frameTitle;
+    unsigned slowProcessingTime; //default 30 seconds
 
 
-    esp_option() : logReq(false), logResp(false), logLevel(1) 
+    esp_option() : logReq(false), logResp(false), logLevel(1), slowProcessingTime(30000)
     { }
     { }
 };
 };
 
 

+ 125 - 2
esp/platform/espcontext.cpp

@@ -28,6 +28,7 @@
 #include "espcontext.hpp"
 #include "espcontext.hpp"
 #include "http/platform/httptransport.ipp"
 #include "http/platform/httptransport.ipp"
 #include "sechandler.hpp"
 #include "sechandler.hpp"
+#include "espprotocol.hpp"
 
 
 class CEspContext : public CInterface, implements IEspContext
 class CEspContext : public CInterface, implements IEspContext
 {
 {
@@ -66,12 +67,28 @@ private:
     SecHandler m_SecurityHandler;
     SecHandler m_SecurityHandler;
     BoolHash  m_optGroups;
     BoolHash  m_optGroups;
 
 
+    StringArray m_traceValues;
+    unsigned    m_active;
+    unsigned    m_creationTime;
+    unsigned    m_processingTime;
+    unsigned    m_exceptionTime;
+    bool        m_hasException;
+    int         m_exceptionCode;
+
 public:
 public:
     IMPLEMENT_IINTERFACE;
     IMPLEMENT_IINTERFACE;
 
 
-    CEspContext() : m_servPort(0), m_bindingValue(0), m_serviceValue(0), 
-        m_toBeAuthenticated(false), options(0), m_clientVer(-1) { }
+    CEspContext() : m_servPort(0), m_bindingValue(0), m_serviceValue(0), m_toBeAuthenticated(false), options(0), m_clientVer(-1)
+    {
+        m_hasException =  false;
+        m_creationTime = msTick();
+        m_active=ActiveRequests::getCount();
+    }
 
 
+    ~CEspContext()
+    {
+        flushTraceSummary();
+    }
     virtual void addOptions(unsigned opts){options|=opts;}
     virtual void addOptions(unsigned opts){options|=opts;}
     virtual void removeOptions(unsigned opts){opts&=~opts;}
     virtual void removeOptions(unsigned opts){opts&=~opts;}
     virtual unsigned queryOptions(){return options;}
     virtual unsigned queryOptions(){return options;}
@@ -167,6 +184,42 @@ public:
         return m_servName.str();
         return m_servName.str();
     }
     }
 
 
+    virtual void setCreationTime()
+    {
+        m_creationTime = msTick();
+    }
+    virtual const unsigned queryCreationTime()
+    {
+        return m_creationTime;
+    }
+    virtual void setProcessingTime()
+    {
+        m_processingTime = msTick() - m_creationTime;
+    }
+    virtual const unsigned queryProcessingTime()
+    {
+        return m_processingTime;
+    }
+    virtual void setException(int exceptionCode)
+    {
+        m_hasException = true;
+        m_exceptionCode = exceptionCode;
+        m_exceptionTime = msTick() - m_creationTime;
+    }
+    virtual const bool queryException(int& exceptionCode, unsigned& exceptionTime)
+    {
+        if (m_hasException)
+        {
+            exceptionCode = m_exceptionCode;
+            exceptionTime = m_exceptionTime;
+        }
+        return m_hasException;
+    }
+    virtual const bool queryHasException()
+    {
+        return m_hasException;
+    }
+
     virtual void setResources(ISecResourceList* rlist)
     virtual void setResources(ISecResourceList* rlist)
     {
     {
         m_resources.setown(rlist);
         m_resources.setown(rlist);
@@ -338,6 +391,69 @@ public:
         m_custom_headers.append(StringBuffer(name).appendf(": %s", val?val:"").str());
         m_custom_headers.append(StringBuffer(name).appendf(": %s", val?val:"").str());
     }
     }
 
 
+    virtual void addTraceSummaryValue(const char *name, const char *value)
+    {
+        StringBuffer str;
+        if (name && *name)
+            str.append(name).append('=');
+        if (value && *value)
+            str.append(value);
+        m_traceValues.append(str.str());
+    }
+
+    virtual void addTraceSummaryValue(const char *name, int value)
+    {
+        StringBuffer str;
+        if (name && *name)
+            str.append(name).append('=');
+        str.append(value);
+        m_traceValues.append(str.str());
+    }
+
+    virtual void addTraceSummaryTimeStamp(const char *name)
+    {
+        if (name && *name)
+        {
+            unsigned timeval=msTick()-m_creationTime;
+            StringBuffer value;
+            value.append(name).append('=').appendulong(timeval).append("ms");
+            m_traceValues.append(value.str());
+        }
+    }
+    virtual void flushTraceSummary()
+    {
+        StringBuffer logstr;
+        logstr.appendf("activeReqs=").append(m_active).append(';');
+        logstr.append("user=").append(queryUserId());
+        if (m_peer.length())
+            logstr.append('@').append(m_peer.get());
+        logstr.append(';');
+
+        if (m_hasException)
+        {
+            logstr.appendf("exception@%dms=%d;", m_exceptionTime, m_exceptionCode);
+        }
+
+        StringBuffer value;
+        value.append("total=").appendulong(m_processingTime).append("ms");
+        if (m_hasException || (getEspLogLevel() > LogNormal))
+        {
+            m_traceValues.append(value.str());
+
+            if (m_traceValues.length())
+            {
+                ForEachItemIn(idx, m_traceValues)
+                    logstr.append(m_traceValues.item(idx)).append(";");
+                m_traceValues.kill();
+            }
+        }
+        else
+        {
+            logstr.appendf("%s;", value.str());
+        }
+
+        DBGLOG("TxSummary[%s]", logstr.str());
+    }
 };
 };
 
 
 //---------------------------------------------------------
 //---------------------------------------------------------
@@ -579,6 +695,13 @@ bool getEspLogResponses()
     return false;
     return false;
 }
 }
 
 
+unsigned getSlowProcessingTime()
+{
+    if (getContainer())
+        return getContainer()->getSlowProcessingTime();
+    return false;
+}
+
 void ESPLOG(LogLevel level, const char* fmt, ...)
 void ESPLOG(LogLevel level, const char* fmt, ...)
 {
 {
     if (getEspLogLevel(NULL)>=level)
     if (getEspLogLevel(NULL)>=level)

+ 1 - 0
esp/platform/espcontext.hpp

@@ -50,6 +50,7 @@ ESPHTTP_API LogLevel getEspLogLevel(IEspContext* );
 ESPHTTP_API LogLevel getEspLogLevel();
 ESPHTTP_API LogLevel getEspLogLevel();
 ESPHTTP_API bool getEspLogRequests();
 ESPHTTP_API bool getEspLogRequests();
 ESPHTTP_API bool getEspLogResponses();
 ESPHTTP_API bool getEspLogResponses();
+ESPHTTP_API unsigned getSlowProcessingTime();
 
 
 ESPHTTP_API void ESPLOG(IEspContext* ctx, LogLevel level, const char* fmt, ...);
 ESPHTTP_API void ESPLOG(IEspContext* ctx, LogLevel level, const char* fmt, ...);
 ESPHTTP_API void ESPLOG(LogLevel level, const char* fmt, ...);
 ESPHTTP_API void ESPLOG(LogLevel level, const char* fmt, ...);

+ 3 - 0
esp/platform/espp.hpp

@@ -57,6 +57,7 @@ private:
     LogLevel m_logLevel;
     LogLevel m_logLevel;
     bool m_logReq;
     bool m_logReq;
     bool m_logResp;
     bool m_logResp;
+    unsigned m_slowProcessingTime;
     StringAttr m_frameTitle;
     StringAttr m_frameTitle;
     Mutex abortMutex;
     Mutex abortMutex;
     bool m_SEHMappingEnabled;
     bool m_SEHMappingEnabled;
@@ -76,6 +77,7 @@ public:
         m_logLevel = config->m_options.logLevel;
         m_logLevel = config->m_options.logLevel;
         m_logReq = config->m_options.logReq;
         m_logReq = config->m_options.logReq;
         m_logResp = config->m_options.logResp;
         m_logResp = config->m_options.logResp;
+        m_slowProcessingTime = config->m_options.slowProcessingTime;
         m_frameTitle.set(config->m_options.frameTitle);
         m_frameTitle.set(config->m_options.frameTitle);
         m_SEHMappingEnabled = false;
         m_SEHMappingEnabled = false;
     }
     }
@@ -148,6 +150,7 @@ public:
     bool getLogResponses() { return m_logResp; }
     bool getLogResponses() { return m_logResp; }
     void setFrameTitle(const char* title)  { m_frameTitle.set(title); }
     void setFrameTitle(const char* title)  { m_frameTitle.set(title); }
     const char* getFrameTitle()  { return m_frameTitle.get(); }
     const char* getFrameTitle()  { return m_frameTitle.get(); }
+    unsigned getSlowProcessingTime() { return m_slowProcessingTime; }
 
 
     void log(LogLevel level, const char* fmt, ...)
     void log(LogLevel level, const char* fmt, ...)
     {
     {

+ 16 - 0
esp/platform/espprotocol.cpp

@@ -30,6 +30,22 @@
 
 
 typedef IXslProcessor * (*getXslProcessor_func)();
 typedef IXslProcessor * (*getXslProcessor_func)();
 
 
+static atomic_t gActiveRequests;
+
+long ActiveRequests::getCount()
+{
+    return atomic_read(&gActiveRequests);
+}
+
+void ActiveRequests::inc()
+{
+    atomic_inc(&gActiveRequests);
+}
+
+void ActiveRequests::dec()
+{
+    atomic_dec(&gActiveRequests);
+}
 
 
 CEspApplicationPort::CEspApplicationPort(bool viewcfg) : bindingCount(0), defBinding(-1), viewConfig(viewcfg), rootAuth(false), navWidth(165), navResize(false), navScroll(false)
 CEspApplicationPort::CEspApplicationPort(bool viewcfg) : bindingCount(0), defBinding(-1), viewConfig(viewcfg), rootAuth(false), navWidth(165), navResize(false), navScroll(false)
 {
 {

+ 13 - 0
esp/platform/espprotocol.hpp

@@ -32,6 +32,19 @@
 #include <map>
 #include <map>
 using namespace std;
 using namespace std;
 
 
+class ActiveRequests
+{
+public:
+
+    ActiveRequests() { inc(); }
+    ~ActiveRequests()  { dec(); }
+
+    void inc();
+    void dec();
+
+    static long getCount();
+};
+
 class CEspBindingEntry : public CInterface
 class CEspBindingEntry : public CInterface
 {
 {
 private:
 private:

+ 13 - 0
esp/scm/esp.ecm

@@ -157,6 +157,13 @@ interface IEspContext : extends IInterface
 
 
     virtual void setServiceName(const char *name)=0;
     virtual void setServiceName(const char *name)=0;
     virtual const char * queryServiceName(const char *name)=0;
     virtual const char * queryServiceName(const char *name)=0;
+    virtual void setCreationTime()=0;
+    virtual const unsigned queryCreationTime()=0;
+    virtual void setProcessingTime()=0;
+    virtual const unsigned queryProcessingTime()=0;
+    virtual void setException(int exceptionCode)=0;
+    virtual const bool queryException(int& exceptionCode, unsigned& exceptionTime)=0;
+    virtual const bool queryHasException()=0;
 
 
     virtual IProperties *   queryRequestParameters()=0;
     virtual IProperties *   queryRequestParameters()=0;
     virtual void            setRequestParameters(IProperties * Parameters)=0;
     virtual void            setRequestParameters(IProperties * Parameters)=0;
@@ -184,6 +191,11 @@ interface IEspContext : extends IInterface
     
     
     virtual StringArray& queryCustomHeaders() = 0;
     virtual StringArray& queryCustomHeaders() = 0;
     virtual void addCustomerHeader(const char* name, const char* val) = 0;
     virtual void addCustomerHeader(const char* name, const char* val) = 0;
+
+    virtual void addTraceSummaryValue(const char *name, const char *value)=0;
+    virtual void addTraceSummaryValue(const char *name, int value)=0;
+    virtual void addTraceSummaryTimeStamp(const char *name)=0;
+    virtual void flushTraceSummary()=0;
 };
 };
 
 
 
 
@@ -200,6 +212,7 @@ interface IEspContainer : extends IInterface
     virtual LogLevel getLogLevel() = 0;
     virtual LogLevel getLogLevel() = 0;
     virtual bool getLogRequests() = 0;
     virtual bool getLogRequests() = 0;
     virtual bool getLogResponses() = 0;
     virtual bool getLogResponses() = 0;
+    virtual unsigned getSlowProcessingTime() = 0;
     virtual void log(LogLevel level, const char*,...) = 0;
     virtual void log(LogLevel level, const char*,...) = 0;
     virtual void setFrameTitle(const char* title) = 0;
     virtual void setFrameTitle(const char* title) = 0;
     virtual const char* getFrameTitle() = 0;
     virtual const char* getFrameTitle() = 0;

+ 1 - 1
esp/services/ws_account/ws_accountService.cpp

@@ -78,7 +78,7 @@ bool Cws_accountEx::onVerifyUser(IEspContext &context, IEspVerifyUserRequest &re
     }
     }
     catch(IException* e)
     catch(IException* e)
     {
     {
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;

+ 34 - 40
esp/services/ws_dfu/ws_dfuService.cpp

@@ -172,7 +172,7 @@ bool CWsDfuEx::onDFUSearch(IEspContext &context, IEspDFUSearchRequest & req, IEs
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -282,7 +282,7 @@ bool CWsDfuEx::onDFUQuery(IEspContext &context, IEspDFUQueryRequest & req, IEspD
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -318,7 +318,7 @@ bool CWsDfuEx::onDFUInfo(IEspContext &context, IEspDFUInfoRequest &req, IEspDFUI
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -553,7 +553,7 @@ bool CWsDfuEx::onDFUSpace(IEspContext &context, IEspDFUSpaceRequest & req, IEspD
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1139,7 +1139,7 @@ bool CWsDfuEx::onAddtoSuperfile(IEspContext &context, IEspAddtoSuperfileRequest
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1402,40 +1402,34 @@ bool CWsDfuEx::onDFUArrayAction(IEspContext &context, IEspDFUArrayActionRequest
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
 
 
 bool CWsDfuEx::onDFUAction(IUserDescriptor* udesc, const char* LogicalFileName, const char* ClusterName,const char* ActionType,bool nodelete, StringBuffer& returnStr)
 bool CWsDfuEx::onDFUAction(IUserDescriptor* udesc, const char* LogicalFileName, const char* ClusterName,const char* ActionType,bool nodelete, StringBuffer& returnStr)
 {
 {
-    try
+    //No 'try/catch' is needed for this method since it will be called internally.
+    if (strcmp(Action_Delete ,ActionType) == 0)
     {
     {
-        if (strcmp(Action_Delete ,ActionType) == 0)
-        {
-            LogicFileWrapper Logicfile;
-            if (!Logicfile.doDeleteFile(LogicalFileName,ClusterName,nodelete, returnStr, udesc))
-                return false;
-        }
-        else if (strcmp(Action_AddtoSuperfile ,ActionType) == 0)
+        LogicFileWrapper Logicfile;
+        if (!Logicfile.doDeleteFile(LogicalFileName,ClusterName,nodelete, returnStr, udesc))
+            return false;
+    }
+    else if (strcmp(Action_AddtoSuperfile ,ActionType) == 0)
+    {
+        Owned<IDistributedFile> df = queryDistributedFileDirectory().lookup(LogicalFileName, udesc, true);
+        if (df)
         {
         {
-            Owned<IDistributedFile> df = queryDistributedFileDirectory().lookup(LogicalFileName, udesc, true);  
-            if (df)
-            {
-                if (returnStr.length() > 0)
-                    returnStr.appendf(",%s", LogicalFileName);
-                else
-                    returnStr.appendf("%s", LogicalFileName);
-                return false;
-            }
+            if (returnStr.length() > 0)
+                returnStr.appendf(",%s", LogicalFileName);
+            else
+                returnStr.appendf("%s", LogicalFileName);
+            return false;
         }
         }
-        else
-            DBGLOG("Unknown Action type:%s\n",ActionType);
-    }
-    catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
     }
     }
+    else
+        DBGLOG("Unknown Action type:%s\n",ActionType);
     
     
     return true;
     return true;
 }
 }
@@ -1484,7 +1478,7 @@ bool CWsDfuEx::onDFUDefFile(IEspContext &context,IEspDFUDefFileRequest &req, IEs
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2131,7 +2125,7 @@ bool CWsDfuEx::onDFUFileView(IEspContext &context, IEspDFUFileViewRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3034,7 +3028,7 @@ bool CWsDfuEx::onSuperfileList(IEspContext &context, IEspSuperfileListRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3093,7 +3087,7 @@ bool CWsDfuEx::onSuperfileAction(IEspContext &context, IEspSuperfileActionReques
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3153,7 +3147,7 @@ bool CWsDfuEx::onSuperfileAddRaw(IEspContext &context, IEspSuperfileAddRawReques
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3182,7 +3176,7 @@ bool CWsDfuEx::onSavexml(IEspContext &context, IEspSavexmlRequest &req, IEspSave
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3207,7 +3201,7 @@ bool CWsDfuEx::onAdd(IEspContext &context, IEspAddRequest &req, IEspAddResponse
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3251,7 +3245,7 @@ bool CWsDfuEx::onAddRemote(IEspContext &context, IEspAddRemoteRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3727,7 +3721,7 @@ bool CWsDfuEx::onDFUGetDataColumns(IEspContext &context, IEspDFUGetDataColumnsRe
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3901,7 +3895,7 @@ bool CWsDfuEx::onDFUSearchData(IEspContext &context, IEspDFUSearchDataRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -4338,7 +4332,7 @@ bool CWsDfuEx::onDFUBrowseData(IEspContext &context, IEspDFUBrowseDataRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 10 - 10
esp/services/ws_dfu/ws_dfuXRefService.cpp

@@ -159,7 +159,7 @@ bool CWsDfuXRefEx::onDFUXRefArrayAction(IEspContext &context, IEspDFUXRefArrayAc
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -200,7 +200,7 @@ bool CWsDfuXRefEx::onDFUXRefLostFiles(IEspContext &context, IEspDFUXRefLostFiles
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -229,7 +229,7 @@ bool CWsDfuXRefEx::onDFUXRefFoundFiles(IEspContext &context, IEspDFUXRefFoundFil
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -258,7 +258,7 @@ bool CWsDfuXRefEx::onDFUXRefOrphanFiles(IEspContext &context, IEspDFUXRefOrphanF
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -286,7 +286,7 @@ bool CWsDfuXRefEx::onDFUXRefMessages(IEspContext &context, IEspDFUXRefMessagesQu
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -315,7 +315,7 @@ bool CWsDfuXRefEx::onDFUXRefCleanDirectories(IEspContext &context, IEspDFUXRefCl
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -386,7 +386,7 @@ bool CWsDfuXRefEx::onDFUXRefDirectories(IEspContext &context, IEspDFUXRefDirecto
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -424,7 +424,7 @@ bool CWsDfuXRefEx::onDFUXRefBuild(IEspContext &context, IEspDFUXRefBuildRequest
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -447,7 +447,7 @@ bool CWsDfuXRefEx::onDFUXRefBuildCancel(IEspContext &context, IEspDFUXRefBuildCa
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -503,7 +503,7 @@ bool CWsDfuXRefEx::onDFUXRefList(IEspContext &context, IEspDFUXRefListRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 1 - 1
esp/services/ws_fs/ws_fsBinding.cpp

@@ -452,7 +452,7 @@ void CFileSpraySoapBindingEx::downloadFile(IEspContext &context, CHttpRequest* r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return;
     return;
 }
 }

+ 79 - 79
esp/services/ws_fs/ws_fsService.cpp

@@ -581,7 +581,7 @@ bool CFileSprayEx::onDFUWUSearch(IEspContext &context, IEspDFUWUSearchRequest &
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1054,7 +1054,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1243,7 +1243,7 @@ bool CFileSprayEx::onGetDFUWorkunit(IEspContext &context, IEspGetDFUWorkunit &re
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1292,7 +1292,7 @@ bool CFileSprayEx::onGetDFUProgress(IEspContext &context, IEspProgressRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1320,7 +1320,7 @@ bool CFileSprayEx::onCreateDFUWorkunit(IEspContext &context, IEspCreateDFUWorkun
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1347,7 +1347,7 @@ bool CFileSprayEx::onUpdateDFUWorkunit(IEspContext &context, IEspUpdateDFUWorkun
 
 
             prog->setState((enum DFUstate)reqWU.getState());
             prog->setState((enum DFUstate)reqWU.getState());
         }
         }
-        
+
         const char* clusterOrig = req.getClusterOrig();
         const char* clusterOrig = req.getClusterOrig();
         const char* cluster = reqWU.getClusterName();
         const char* cluster = reqWU.getClusterName();
         if(cluster && (!clusterOrig || stricmp(clusterOrig, cluster)))
         if(cluster && (!clusterOrig || stricmp(clusterOrig, cluster)))
@@ -1371,7 +1371,7 @@ bool CFileSprayEx::onUpdateDFUWorkunit(IEspContext &context, IEspUpdateDFUWorkun
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1416,7 +1416,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
                 res->setID(wuids.item(i));
                 res->setID(wuids.item(i));
                 res->setAction("Delete");
                 res->setAction("Delete");
                 res->setResult("Success");
                 res->setResult("Success");
-                
+
                 try
                 try
                 {
                 {
                     if (markWUFailed(factory, wuids.item(i)))
                     if (markWUFailed(factory, wuids.item(i)))
@@ -1462,14 +1462,14 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
             Owned<ISashaCommand> cmd = createSashaCommand();
             Owned<ISashaCommand> cmd = createSashaCommand();
             cmd->setAction(SCA_RESTORE);
             cmd->setAction(SCA_RESTORE);
             cmd->setDFU(true);  
             cmd->setDFU(true);  
-            
+
             StringArray & wuids = req.getWuids();
             StringArray & wuids = req.getWuids();
             for(unsigned ii = 0; ii < wuids.ordinality(); ++ii)
             for(unsigned ii = 0; ii < wuids.ordinality(); ++ii)
             {
             {
                 StringBuffer msg;
                 StringBuffer msg;
                 const char *wuid = wuids.item(ii);
                 const char *wuid = wuids.item(ii);
                 cmd->addId(wuid);
                 cmd->addId(wuid);
-                
+
                 if (!cmd->send(node,1*60*1000)) 
                 if (!cmd->send(node,1*60*1000)) 
                 {
                 {
                     throw MakeStringException(ECLWATCH_CANNOT_CONNECT_ARCHIVE_SERVER,"Cannot connect to archive server at %s.",sashaAddress.str());
                     throw MakeStringException(ECLWATCH_CANNOT_CONNECT_ARCHIVE_SERVER,"Cannot connect to archive server at %s.",sashaAddress.str());
@@ -1491,7 +1491,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
                 res->setID(wuid);
                 res->setID(wuid);
                 res->setAction("Restore");
                 res->setAction("Restore");
                 res->setResult(msg.str());
                 res->setResult(msg.str());
-                
+
                 results.append(*LINK(res.getClear()));
                 results.append(*LINK(res.getClear()));
             }
             }
         }
         }
@@ -1505,7 +1505,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
                 res->setID(wuids.item(i));
                 res->setID(wuids.item(i));
                 res->setAction("Protect");
                 res->setAction("Protect");
                 res->setResult("Success");
                 res->setResult("Success");
-                
+
                 try
                 try
                 {
                 {
                     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
                     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
@@ -1541,7 +1541,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
                 res->setID(wuids.item(i));
                 res->setID(wuids.item(i));
                 res->setAction("Unprotect");
                 res->setAction("Unprotect");
                 res->setResult("Success");
                 res->setResult("Success");
-                
+
                 try
                 try
                 {
                 {
                     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
                     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
@@ -1622,7 +1622,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1646,7 +1646,7 @@ bool CFileSprayEx::onDeleteDFUWorkunits(IEspContext &context, IEspDeleteDFUWorku
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1658,7 +1658,7 @@ bool CFileSprayEx::onDeleteDFUWorkunit(IEspContext &context, IEspDeleteDFUWorkun
     {
     {
         if (!context.validateFeatureAccess(DFU_WU_URL, SecAccess_Write, false))
         if (!context.validateFeatureAccess(DFU_WU_URL, SecAccess_Write, false))
             throw MakeStringException(ECLWATCH_DFU_WU_ACCESS_DENIED, "Failed to delete DFU workunit. Permission denied.");
             throw MakeStringException(ECLWATCH_DFU_WU_ACCESS_DENIED, "Failed to delete DFU workunit. Permission denied.");
-        
+
         Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
         Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
         if (markWUFailed(factory, req.getWuid()))
         if (markWUFailed(factory, req.getWuid()))
             resp.setResult(factory->deleteWorkUnit(req.getWuid()));
             resp.setResult(factory->deleteWorkUnit(req.getWuid()));
@@ -1669,7 +1669,7 @@ bool CFileSprayEx::onDeleteDFUWorkunit(IEspContext &context, IEspDeleteDFUWorkun
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1692,7 +1692,7 @@ bool CFileSprayEx::onSubmitDFUWorkunit(IEspContext &context, IEspSubmitDFUWorkun
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1715,7 +1715,7 @@ bool CFileSprayEx::onAbortDFUWorkunit(IEspContext &context, IEspAbortDFUWorkunit
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1751,7 +1751,7 @@ bool CFileSprayEx::onGetDFUExceptions(IEspContext &context, IEspGetDFUExceptions
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1843,27 +1843,27 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
         if(recordsize > 0)
         if(recordsize > 0)
             source->setRecordSize(recordsize);
             source->setRecordSize(recordsize);
         else if (recordsize == RECFMVB_RECSIZE_ESCAPE) {
         else if (recordsize == RECFMVB_RECSIZE_ESCAPE) {
-            source->setFormat(DFUff_recfmvb);       
-            destination->setFormat(DFUff_variable);     
+            source->setFormat(DFUff_recfmvb);
+            destination->setFormat(DFUff_variable);
         }
         }
         else if (recordsize == RECFMV_RECSIZE_ESCAPE) {
         else if (recordsize == RECFMV_RECSIZE_ESCAPE) {
-            source->setFormat(DFUff_recfmv);        
-            destination->setFormat(DFUff_variable);     
+            source->setFormat(DFUff_recfmv);
+            destination->setFormat(DFUff_variable);
         }
         }
         else if (recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) {
         else if (recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) {
-            source->setFormat(DFUff_variable);      
-            destination->setFormat(DFUff_variable);     
+            source->setFormat(DFUff_variable);
+            destination->setFormat(DFUff_variable);
         }
         }
         else if (recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) {
         else if (recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) {
-            source->setFormat(DFUff_variablebigendian);     
-            destination->setFormat(DFUff_variable);     
+            source->setFormat(DFUff_variablebigendian);
+            destination->setFormat(DFUff_variable);
         }
         }
         destination->setLogicalName(destname);
         destination->setLogicalName(destname);
         destination->setDirectory(destFolder.str());
         destination->setDirectory(destFolder.str());
 
 
         StringBuffer fileMask;
         StringBuffer fileMask;
         constructFileMask(destTitle.str(), fileMask);
         constructFileMask(destTitle.str(), fileMask);
-        destination->setFileMask(fileMask.str()); 
+        destination->setFileMask(fileMask.str());
         destination->setGroupName(gName.str());
         destination->setGroupName(gName.str());
         const char * encryptkey = req.getEncrypt();
         const char * encryptkey = req.getEncrypt();
         if(req.getCompress()||(encryptkey&&*encryptkey))
         if(req.getCompress()||(encryptkey&&*encryptkey))
@@ -1914,7 +1914,7 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1999,7 +1999,7 @@ bool CFileSprayEx::onSprayVariable(IEspContext &context, IEspSprayVariable &req,
         }
         }
         source->setMaxRecordSize(req.getSourceMaxRecordSize());
         source->setMaxRecordSize(req.getSourceMaxRecordSize());
         source->setFormat((DFUfileformat)req.getSourceFormat());
         source->setFormat((DFUfileformat)req.getSourceFormat());
-        
+
         // if rowTag specified, it means it's xml format, otherwise it's csv
         // if rowTag specified, it means it's xml format, otherwise it's csv
         const char* rowtag = req.getSourceRowTag();
         const char* rowtag = req.getSourceRowTag();
         if(rowtag != NULL && *rowtag != '\0')
         if(rowtag != NULL && *rowtag != '\0')
@@ -2070,7 +2070,7 @@ bool CFileSprayEx::onSprayVariable(IEspContext &context, IEspSprayVariable &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -2119,7 +2119,7 @@ bool CFileSprayEx::onReplicate(IEspContext &context, IEspReplicate &req, IEspRep
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -2179,12 +2179,12 @@ bool CFileSprayEx::onDespray(IEspContext &context, IEspDespray &req, IEspDespray
         {
         {
             dstxml.append('\0');
             dstxml.append('\0');
             destination->setFromXML((const char*)dstxml.toByteArray());
             destination->setFromXML((const char*)dstxml.toByteArray());
-        }   
+        }
         destination->setTitle(srcTitle.str());
         destination->setTitle(srcTitle.str());
 
 
         options->setKeepHeader(true);
         options->setKeepHeader(true);
         options->setOverwrite(req.getOverwrite());             // needed if target already exists
         options->setOverwrite(req.getOverwrite());             // needed if target already exists
-        
+
         const char* splitprefix = req.getSplitprefix();
         const char* splitprefix = req.getSplitprefix();
         if(splitprefix && *splitprefix)
         if(splitprefix && *splitprefix)
             options->setSplitPrefix(splitprefix);
             options->setSplitPrefix(splitprefix);
@@ -2215,7 +2215,7 @@ bool CFileSprayEx::onDespray(IEspContext &context, IEspDespray &req, IEspDespray
             options->setPush();             // I think needed for a despray
             options->setPush();             // I think needed for a despray
             destination->setWrap(true);
             destination->setWrap(true);
         }
         }
-        if (req.getMultiCopy()) 
+        if (req.getMultiCopy())
             destination->setMultiCopy(true);
             destination->setMultiCopy(true);
 
 
         const char * encryptkey = req.getEncrypt();
         const char * encryptkey = req.getEncrypt();
@@ -2229,19 +2229,19 @@ bool CFileSprayEx::onDespray(IEspContext &context, IEspDespray &req, IEspDespray
         resp.setWuid(wu->queryId());
         resp.setWuid(wu->queryId());
 
 
         wu->submit();                            // enqueue job(does implicit commit)
         wu->submit();                            // enqueue job(does implicit commit)
-         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
+        resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
 }
 }
 
 
 bool CFileSprayEx::doCopyForRoxie(IEspContext &context,     const char * srcName, const char * srcDali, const char * srcUser, const char * srcPassword,
 bool CFileSprayEx::doCopyForRoxie(IEspContext &context,     const char * srcName, const char * srcDali, const char * srcUser, const char * srcPassword,
-    const char * dstName, const char * destCluster, bool compressed, bool overwrite, bool supercopy,
-    DFUclusterPartDiskMapping val, StringBuffer baseDir, StringBuffer fileMask, IEspCopyResponse &resp)
+                                  const char * dstName, const char * destCluster, bool compressed, bool overwrite, bool supercopy,
+                                  DFUclusterPartDiskMapping val, StringBuffer baseDir, StringBuffer fileMask, IEspCopyResponse &resp)
 {
 {
     StringBuffer user, passwd;
     StringBuffer user, passwd;
     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
     Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
@@ -2318,7 +2318,7 @@ bool CFileSprayEx::doCopyForRoxie(IEspContext &context,     const char * srcName
 
 
         options->setSuppressNonKeyRepeats(true);                            // **** only repeat last part when src kind = key
         options->setSuppressNonKeyRepeats(true);                            // **** only repeat last part when src kind = key
     }
     }
-    
+
     resp.setResult(wu->queryId());
     resp.setResult(wu->queryId());
     wu->submit();                            // enqueue job(does implicit commit)
     wu->submit();                            // enqueue job(does implicit commit)
     resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
     resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
@@ -2338,7 +2338,7 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Source logical file not specified.");
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Source logical file not specified.");
         if(!dstname || !*dstname)
         if(!dstname || !*dstname)
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Destination logical file not specified.");
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Destination logical file not specified.");
-        
+
         StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder;
         StringBuffer destFolder, destTitle, defaultFolder, defaultReplicateFolder;
         StringBuffer srcCluster, destCluster, destClusterName;
         StringBuffer srcCluster, destCluster, destClusterName;
         bool bRoxie = false;
         bool bRoxie = false;
@@ -2437,9 +2437,9 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
         IDFUfileSpec *source = wu->queryUpdateSource();
         IDFUfileSpec *source = wu->queryUpdateSource();
         IDFUfileSpec *destination = wu->queryUpdateDestination();
         IDFUfileSpec *destination = wu->queryUpdateDestination();
         IDFUoptions *options = wu->queryUpdateOptions();
         IDFUoptions *options = wu->queryUpdateOptions();
-        
-        if (supercopy)  
-            wu->setCommand(DFUcmd_supercopy);   
+
+        if (supercopy)
+            wu->setCommand(DFUcmd_supercopy);
         else
         else
             wu->setCommand(DFUcmd_copy);
             wu->setCommand(DFUcmd_copy);
 
 
@@ -2470,13 +2470,13 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
                 destination->setReplicateOffset(offset);
                 destination->setReplicateOffset(offset);
             }
             }
         }
         }
-            
+
         if (srcDiffKeyName&&*srcDiffKeyName)
         if (srcDiffKeyName&&*srcDiffKeyName)
             source->setDiffKey(srcDiffKeyName);
             source->setDiffKey(srcDiffKeyName);
         if (destDiffKeyName&&*destDiffKeyName)
         if (destDiffKeyName&&*destDiffKeyName)
             destination->setDiffKey(destDiffKeyName);
             destination->setDiffKey(destDiffKeyName);
 
 
-        if (!bRoxie) 
+        if (!bRoxie)
         {
         {
             destination->setDirectory(destFolder.str());
             destination->setDirectory(destFolder.str());
             ClusterPartDiskMapSpec mspec;
             ClusterPartDiskMapSpec mspec;
@@ -2493,7 +2493,7 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
         if(req.getCompress()||(encryptkey&&*encryptkey))
         if(req.getCompress()||(encryptkey&&*encryptkey))
             destination->setCompressed(true);
             destination->setCompressed(true);
 
 
-        if (!bRoxie) 
+        if (!bRoxie)
         {
         {
             options->setReplicate(req.getReplicate());
             options->setReplicate(req.getReplicate());
             destination->setWrap(req.getWrap());
             destination->setWrap(req.getWrap());
@@ -2530,8 +2530,8 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2573,7 +2573,7 @@ bool CFileSprayEx::onRename(IEspContext &context, IEspRename &req, IEspRenameRes
             Owned<IDistributedFile> df = queryDistributedFileDirectory().lookup(srcname, udesc);
             Owned<IDistributedFile> df = queryDistributedFileDirectory().lookup(srcname, udesc);
             if(df)
             if(df)
             {
             {
-                StringBuffer cluster0; 
+                StringBuffer cluster0;
                 df->getClusterName(0,cluster0);                     // TBD - Handling for multiple clusters?
                 df->getClusterName(0,cluster0);                     // TBD - Handling for multiple clusters?
                 if (cluster0.length()!=0)
                 if (cluster0.length()!=0)
                 {
                 {
@@ -2603,8 +2603,8 @@ bool CFileSprayEx::onRename(IEspContext &context, IEspRename &req, IEspRenameRes
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2643,8 +2643,8 @@ bool CFileSprayEx::onDFUWUFile(IEspContext &context, IEspDFUWUFileRequest &req,
         }
         }
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -2664,7 +2664,7 @@ int CFileSprayEx::doFileCheck(const char* mask, const char* netaddr, const char*
         iRet = 2;
         iRet = 2;
 
 
         Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
         Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
-       factory->validateCache();
+        factory->validateCache();
         Owned<IConstEnvironment> env = factory->openEnvironmentByFile();
         Owned<IConstEnvironment> env = factory->openEnvironmentByFile();
         Owned<IPropertyTree> pEnvRoot = &env->getPTree();
         Owned<IPropertyTree> pEnvRoot = &env->getPTree();
         IPropertyTree* pEnvSoftware = pEnvRoot->queryPropTree("Software");
         IPropertyTree* pEnvSoftware = pEnvRoot->queryPropTree("Software");
@@ -2683,7 +2683,7 @@ int CFileSprayEx::doFileCheck(const char* mask, const char* netaddr, const char*
                 xpath.appendf("Hardware/Computer[@name='%s']/@netAddress", pszComputer);
                 xpath.appendf("Hardware/Computer[@name='%s']/@netAddress", pszComputer);
                 const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
                 const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
                 if (strcmp(pszNetAddr, "."))
                 if (strcmp(pszNetAddr, "."))
-                {       
+                {
                     sNetAddr.append(pszNetAddr);
                     sNetAddr.append(pszNetAddr);
                 }
                 }
                 else
                 else
@@ -2781,7 +2781,7 @@ bool CFileSprayEx::onFileList(IEspContext &context, IEspFileListRequest &req, IE
         Owned<IDirectoryIterator> di = f->directoryFiles(NULL, false, true);
         Owned<IDirectoryIterator> di = f->directoryFiles(NULL, false, true);
         if(di.get() != NULL)
         if(di.get() != NULL)
         {
         {
-            ForEach(*di) 
+            ForEach(*di)
             {
             {
                 StringBuffer fname;
                 StringBuffer fname;
                 di->getName(fname);
                 di->getName(fname);
@@ -2805,7 +2805,7 @@ bool CFileSprayEx::onFileList(IEspContext &context, IEspFileListRequest &req, IE
                 files.append(*onefile.getLink());
                 files.append(*onefile.getLink());
             }
             }
         }
         }
-        
+
         sPath.replace('\\', '/');//XSLT cannot handle backslashes
         sPath.replace('\\', '/');//XSLT cannot handle backslashes
         resp.setPath(sPath);
         resp.setPath(sPath);
         resp.setFiles(files);
         resp.setFiles(files);
@@ -2822,8 +2822,8 @@ bool CFileSprayEx::onFileList(IEspContext &context, IEspFileListRequest &req, IE
         resp.setDirectoryOnly(directoryOnly);
         resp.setDirectoryOnly(directoryOnly);
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -2868,7 +2868,7 @@ bool CFileSprayEx::onDfuMonitor(IEspContext &context, IEspDfuMonitorRequest &req
             else
             else
                 throw MakeStringException(ECLWATCH_INVALID_INPUT, "Neither logical name nor network ip/file specified for monitor.");
                 throw MakeStringException(ECLWATCH_INVALID_INPUT, "Neither logical name nor network ip/file specified for monitor.");
         }
         }
-        if (eventname) 
+        if (eventname)
             monitor->setEventName(eventname);
             monitor->setEventName(eventname);
         monitor->setShotLimit(req.getShotLimit());
         monitor->setShotLimit(req.getShotLimit());
         monitor->setSub(req.getSub());
         monitor->setSub(req.getSub());
@@ -2880,8 +2880,8 @@ bool CFileSprayEx::onDfuMonitor(IEspContext &context, IEspDfuMonitorRequest &req
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -2915,15 +2915,15 @@ bool CFileSprayEx::onOpenSave(IEspContext &context, IEspOpenSaveRequest &req, IE
             resp.setViewable(false);
             resp.setViewable(false);
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
 }
 }
 
 
 bool CFileSprayEx::getDropZoneFiles(IEspContext &context, const char* netaddr, const char* osStr, const char* path,
 bool CFileSprayEx::getDropZoneFiles(IEspContext &context, const char* netaddr, const char* osStr, const char* path,
-                                                IEspDropZoneFilesRequest &req, IEspDropZoneFilesResponse &resp)
+                                    IEspDropZoneFilesRequest &req, IEspDropZoneFilesResponse &resp)
 {
 {
     bool directoryOnly = req.getDirectoryOnly();
     bool directoryOnly = req.getDirectoryOnly();
 
 
@@ -2950,7 +2950,7 @@ bool CFileSprayEx::getDropZoneFiles(IEspContext &context, const char* netaddr, c
     Owned<IDirectoryIterator> di = f->directoryFiles(NULL, false, true);
     Owned<IDirectoryIterator> di = f->directoryFiles(NULL, false, true);
     if(di.get() != NULL)
     if(di.get() != NULL)
     {
     {
-        ForEach(*di) 
+        ForEach(*di)
         {
         {
             StringBuffer fname;
             StringBuffer fname;
             di->getName(fname);
             di->getName(fname);
@@ -2974,7 +2974,7 @@ bool CFileSprayEx::getDropZoneFiles(IEspContext &context, const char* netaddr, c
             files.append(*onefile.getLink());
             files.append(*onefile.getLink());
         }
         }
     }
     }
-    
+
     resp.setFiles(files);
     resp.setFiles(files);
 
 
     return true;
     return true;
@@ -3023,7 +3023,7 @@ bool CFileSprayEx::onDropZoneFiles(IEspContext &context, IEspDropZoneFilesReques
                 StringBuffer sNetAddr;
                 StringBuffer sNetAddr;
                 const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
                 const char* pszNetAddr = pEnvRoot->queryProp(xpath.str());
                 if (strcmp(pszNetAddr, "."))
                 if (strcmp(pszNetAddr, "."))
-                {       
+                {
                     sNetAddr.append(pszNetAddr);
                     sNetAddr.append(pszNetAddr);
                 }
                 }
                 else
                 else
@@ -3054,17 +3054,17 @@ bool CFileSprayEx::onDropZoneFiles(IEspContext &context, IEspDropZoneFilesReques
                 StringBuffer dir;
                 StringBuffer dir;
                 pDropZone.getProp("@directory", dir);
                 pDropZone.getProp("@directory", dir);
 
 
-            Owned<IEspDropZone> aDropZone= createDropZone("","");
+                Owned<IEspDropZone> aDropZone= createDropZone("","");
 
 
                 if (machine)
                 if (machine)
                 {
                 {
                     if (machine->getOS() == MachineOsLinux || machine->getOS() == MachineOsSolaris)
                     if (machine->getOS() == MachineOsLinux || machine->getOS() == MachineOsSolaris)
-                    {         
+                    {
                         dir.replace('\\', '/');//replace all '\\' by '/'
                         dir.replace('\\', '/');//replace all '\\' by '/'
                         aDropZone->setLinux("true");
                         aDropZone->setLinux("true");
                     }
                     }
                     else
                     else
-                    {       
+                    {
                         dir.replace('/', '\\');
                         dir.replace('/', '\\');
                         dir.replace('$', ':');
                         dir.replace('$', ':');
                     }
                     }
@@ -3100,7 +3100,7 @@ bool CFileSprayEx::onDropZoneFiles(IEspContext &context, IEspDropZoneFilesReques
         }
         }
 
 
         directoryStr.replace(pathSep=='\\'?'/':'\\', pathSep);
         directoryStr.replace(pathSep=='\\'?'/':'\\', pathSep);
-        
+
         if (subfolder && *subfolder)
         if (subfolder && *subfolder)
         {
         {
             if (*(directoryStr.str() + directoryStr.length() -1) != pathSep)
             if (*(directoryStr.str() + directoryStr.length() -1) != pathSep)
@@ -3116,14 +3116,14 @@ bool CFileSprayEx::onDropZoneFiles(IEspContext &context, IEspDropZoneFilesReques
 
 
         if (pathSep=='\\')
         if (pathSep=='\\')
             directoryStr.replaceString("\\", "\\\\");
             directoryStr.replaceString("\\", "\\\\");
-        
+
         resp.setNetAddress(netAddressStr.str());
         resp.setNetAddress(netAddressStr.str());
         resp.setPath(directoryStr.str());
         resp.setPath(directoryStr.str());
         resp.setOS(atoi(osStr.str()));
         resp.setOS(atoi(osStr.str()));
     }
     }
     catch(IException* e)
     catch(IException* e)
-    {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+    {
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -3190,7 +3190,7 @@ bool CFileSprayEx::onDeleteDropZoneFiles(IEspContext &context, IEspDeleteDropZon
             res->setID(files.item(i));
             res->setID(files.item(i));
             res->setAction("Delete");
             res->setAction("Delete");
             res->setResult("Success");
             res->setResult("Success");
-            
+
             try
             try
             {
             {
                 StringBuffer fileToDelete = sPath;
                 StringBuffer fileToDelete = sPath;
@@ -3225,7 +3225,7 @@ bool CFileSprayEx::onDeleteDropZoneFiles(IEspContext &context, IEspDeleteDropZon
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;

+ 3 - 3
esp/services/ws_machine/ws_machineService.cpp

@@ -441,7 +441,7 @@ bool Cws_machineEx::onGetMachineInfo(IEspContext &context, IEspGetMachineInfoReq
     }
     }
     catch(IException* e)
     catch(IException* e)
     {
     {
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 #ifdef DETECT_WS_MC_MEM_LEAKS
 #ifdef DETECT_WS_MC_MEM_LEAKS
     DBGLOG("Allocated=%d", setAllocHook(false));
     DBGLOG("Allocated=%d", setAllocHook(false));
@@ -481,7 +481,7 @@ bool Cws_machineEx::onGetMachineInfoEx(IEspContext &context, IEspGetMachineInfoR
     }
     }
     catch(IException* e)
     catch(IException* e)
     {
     {
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 
 
@@ -2803,7 +2803,7 @@ bool Cws_machineEx::onGetTargetClusterInfo(IEspContext &context, IEspGetTargetCl
     }
     }
     catch(IException* e)
     catch(IException* e)
     {
     {
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 #ifdef DETECT_WS_MC_MEM_LEAKS
 #ifdef DETECT_WS_MC_MEM_LEAKS
     DBGLOG("Allocated=%d", setAllocHook(false));
     DBGLOG("Allocated=%d", setAllocHook(false));

+ 1 - 1
esp/services/ws_machine/ws_machineServiceMetrics.cpp

@@ -790,7 +790,7 @@ bool Cws_machineEx::onGetMetrics(IEspContext &context, IEspMetricsRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 3 - 3
esp/services/ws_machine/ws_machineServiceRexec.cpp

@@ -791,7 +791,7 @@ bool Cws_machineEx::onStartStop( IEspContext &context, IEspStartStopRequest &req
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -881,7 +881,7 @@ bool Cws_machineEx::onStartStopBegin( IEspContext &context, IEspStartStopBeginRe
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -944,7 +944,7 @@ bool Cws_machineEx::onStartStopDone( IEspContext &context, IEspStartStopDoneRequ
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 3 - 3
esp/services/ws_roxiequery/ws_roxiequeryservice.cpp

@@ -255,7 +255,7 @@ bool CWsRoxieQueryEx::onRoxieQuerySearch(IEspContext &context, IEspRoxieQuerySea
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -522,7 +522,7 @@ bool CWsRoxieQueryEx::onRoxieQueryList(IEspContext &context, IEspRoxieQueryListR
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -632,7 +632,7 @@ bool CWsRoxieQueryEx::onQueryDetails(IEspContext &context, IEspRoxieQueryDetails
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 15 - 15
esp/services/ws_smc/ws_smcService.cpp

@@ -895,7 +895,7 @@ if (buf.length() > 0)
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -951,7 +951,7 @@ bool CWsSMCEx::onMoveJobDown(IEspContext &context, IEspSMCJobRequest &req, IEspS
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -978,7 +978,7 @@ bool CWsSMCEx::onMoveJobUp(IEspContext &context, IEspSMCJobRequest &req, IEspSMC
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1023,7 +1023,7 @@ bool CWsSMCEx::onMoveJobBack(IEspContext &context, IEspSMCJobRequest &req, IEspS
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1068,7 +1068,7 @@ bool CWsSMCEx::onMoveJobFront(IEspContext &context, IEspSMCJobRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1096,7 +1096,7 @@ bool CWsSMCEx::onRemoveJob(IEspContext &context, IEspSMCJobRequest &req, IEspSMC
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1113,7 +1113,7 @@ bool CWsSMCEx::onStopQueue(IEspContext &context, IEspSMCQueueRequest &req, IEspS
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1130,7 +1130,7 @@ bool CWsSMCEx::onResumeQueue(IEspContext &context, IEspSMCQueueRequest &req, IEs
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1147,7 +1147,7 @@ bool CWsSMCEx::onPauseQueue(IEspContext &context, IEspSMCQueueRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1169,7 +1169,7 @@ bool CWsSMCEx::onClearQueue(IEspContext &context, IEspSMCQueueRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1198,7 +1198,7 @@ bool CWsSMCEx::onSetJobPriority(IEspContext &context, IEspSMCPriorityRequest &re
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1246,7 +1246,7 @@ bool CWsSMCEx::onGetThorQueueAvailability(IEspContext &context, IEspGetThorQueue
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1323,7 +1323,7 @@ bool CWsSMCEx::onSetBanner(IEspContext &context, IEspSetBannerRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1482,7 +1482,7 @@ bool CWsSMCEx::onBrowseResources(IEspContext &context, IEspBrowseResourcesReques
     }
     }
     catch(IException* e)
     catch(IException* e)
     {
     {
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -1523,7 +1523,7 @@ int CWsSMCSoapBindingEx::onGetForm(IEspContext &context, CHttpRequest* request,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return onGetForm(context, request, response, service, method);
     return onGetForm(context, request, response, service, method);
 }
 }

+ 13 - 13
esp/services/ws_topology/ws_topologyService.cpp

@@ -128,7 +128,7 @@ bool CWsTopologyEx::onTpSwapNode(IEspContext &context,IEspTpSwapNodeRequest  &re
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -146,7 +146,7 @@ bool CWsTopologyEx::onTpSetMachineStatus(IEspContext &context,IEspTpSetMachineSt
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -415,7 +415,7 @@ bool CWsTopologyEx::onTpLogFile(IEspContext &context,IEspTpLogFileRequest  &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -567,7 +567,7 @@ bool CWsTopologyEx::onSystemLog(IEspContext &context,IEspSystemLogRequest  &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -592,7 +592,7 @@ bool CWsTopologyEx::onTpXMLFile(IEspContext &context,IEspTpXMLFileRequest  &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1207,7 +1207,7 @@ bool CWsTopologyEx::onTpClusterQuery(IEspContext &context, IEspTpClusterQueryReq
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return false;
     return false;
 }
 }
@@ -1258,7 +1258,7 @@ bool CWsTopologyEx::onTpTargetClusterQuery(IEspContext &context, IEspTpTargetClu
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return false;
     return false;
 }
 }
@@ -1301,7 +1301,7 @@ bool CWsTopologyEx::onTpLogicalClusterQuery(IEspContext &context, IEspTpLogicalC
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     
     
     return true;
     return true;
@@ -1322,7 +1322,7 @@ bool CWsTopologyEx::onTpGroupQuery(IEspContext &context, IEspTpGroupQueryRequest
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1378,7 +1378,7 @@ bool CWsTopologyEx::onTpClusterInfo(IEspContext &context, IEspTpClusterInfoReque
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1441,7 +1441,7 @@ bool CWsTopologyEx::onTpServiceQuery(IEspContext &context, IEspTpServiceQueryReq
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -1510,7 +1510,7 @@ bool CWsTopologyEx::onTpMachineQuery(IEspContext &context, IEspTpMachineQueryReq
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return false;
     return false;
 }
 }
@@ -1814,7 +1814,7 @@ bool CWsTopologyEx::onTpGetComponentFile(IEspContext &context,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }

+ 39 - 40
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -1154,7 +1154,7 @@ int CWsWorkunitsSoapBindingEx::onGetForm(IEspContext &context, CHttpRequest* req
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return onGetNotFound(context, request, response, service);
     return onGetNotFound(context, request, response, service);
 }
 }
@@ -2112,7 +2112,7 @@ int CWsWorkunitsSoapBindingEx::onGet(CHttpRequest* request, CHttpResponse* respo
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(*request->queryContext(), e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
 
 
@@ -2507,7 +2507,7 @@ bool CWsWorkunitsEx::onWUProcessGraph(IEspContext &context,IEspWUProcessGraphReq
 
 
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2614,7 +2614,7 @@ bool CWsWorkunitsEx::onWUGetGraph(IEspContext& context, IEspWUGetGraphRequest& r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2845,7 +2845,7 @@ bool CWsWorkunitsEx::onWUResultBin(IEspContext &context,IEspWUResultBinRequest &
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -2974,7 +2974,7 @@ bool CWsWorkunitsEx::onWUResult(IEspContext &context, IEspWUResultRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -3096,7 +3096,7 @@ bool CWsWorkunitsEx::onWUResultSummary(IEspContext &context, IEspWUResultSummary
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -3285,7 +3285,7 @@ bool CWsWorkunitsEx::onWUFile(IEspContext &context,IEspWULogFileRequest &req, IE
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -3731,7 +3731,7 @@ bool CWsWorkunitsEx::onWUQuery(IEspContext &context, IEspWUQueryRequest & req, I
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -4938,7 +4938,7 @@ bool CWsWorkunitsEx::onWUShowScheduled(IEspContext &context, IEspWUShowScheduled
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -4967,7 +4967,7 @@ bool CWsWorkunitsEx::onWUExport(IEspContext &context, IEspWUExportRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -6327,7 +6327,6 @@ bool CWsWorkunitsEx::onWUInfo(IEspContext &context, IEspWUInfoRequest &req, IEsp
     try
     try
     {
     {
         const char *type = req.getType();
         const char *type = req.getType();
-        
 
 
         if (type && *type && !stricmp(type, "archived workunits"))
         if (type && *type && !stricmp(type, "archived workunits"))
         {
         {
@@ -6377,7 +6376,7 @@ bool CWsWorkunitsEx::onWUInfo(IEspContext &context, IEspWUInfoRequest &req, IEsp
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -6406,7 +6405,7 @@ bool CWsWorkunitsEx::onWUGraphInfo(IEspContext &context,IEspWUGraphInfoRequest &
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -6431,7 +6430,7 @@ bool CWsWorkunitsEx::onGVCAjaxGraph(IEspContext &context, IEspGVCAjaxGraphReques
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -6491,7 +6490,7 @@ bool CWsWorkunitsEx::onWUGVCGraphInfo(IEspContext &context,IEspWUGVCGraphInfoReq
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     
     
     return true;
     return true;
@@ -6656,7 +6655,7 @@ bool CWsWorkunitsEx::onWUGraphTiming(IEspContext &context, IEspWUGraphTimingRequ
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
 
 
     return true;
     return true;
@@ -7583,7 +7582,7 @@ bool CWsWorkunitsEx::onWUUpdate(IEspContext &context, IEspWUUpdateRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -7610,7 +7609,7 @@ bool CWsWorkunitsEx::onWUPushEvent(IEspContext &context, IEspWUPushEventRequest
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return false;
     return false;
 }
 }
@@ -7727,7 +7726,7 @@ bool CWsWorkunitsEx::onWUAction(IEspContext &context, IEspWUActionRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -7745,7 +7744,7 @@ bool CWsWorkunitsEx::onWUDelete(IEspContext &context, IEspWUDeleteRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -7763,7 +7762,7 @@ bool CWsWorkunitsEx::onWUAbort(IEspContext &context, IEspWUAbortRequest &req, IE
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -7786,7 +7785,7 @@ bool CWsWorkunitsEx::onWUProtect(IEspContext &context, IEspWUProtectRequest &req
         }
         }
         catch(IException* e)
         catch(IException* e)
         {   
         {   
-            FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+            FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -7864,7 +7863,7 @@ bool CWsWorkunitsEx::onWUResubmit(IEspContext &context, IEspWUResubmitRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -7935,7 +7934,7 @@ bool CWsWorkunitsEx::onWUSchedule(IEspContext &context, IEspWUScheduleRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -7969,7 +7968,7 @@ bool CWsWorkunitsEx::onWUSubmit(IEspContext &context, IEspWUSubmitRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -7992,7 +7991,7 @@ bool CWsWorkunitsEx::onWUCreate(IEspContext &context, IEspWUCreateRequest &req,
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -8014,7 +8013,7 @@ bool CWsWorkunitsEx::onWUCreateAndUpdate(IEspContext &context, IEspWUUpdateReque
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return onWUUpdate(context, req, resp);
     return onWUUpdate(context, req, resp);
 }
 }
@@ -8028,7 +8027,7 @@ bool CWsWorkunitsEx::onWUWaitCompiled(IEspContext &context, IEspWUWaitRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -8041,7 +8040,7 @@ bool CWsWorkunitsEx::onWUWaitComplete(IEspContext &context, IEspWUWaitRequest &r
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -8056,7 +8055,7 @@ bool CWsWorkunitsEx::onWUCDebug(IEspContext &context, IEspWUDebugRequest &req, I
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -8108,7 +8107,7 @@ bool CWsWorkunitsEx::onWUSyntaxCheckECL(IEspContext &context, IEspWUSyntaxCheckR
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -8203,7 +8202,7 @@ bool CWsWorkunitsEx::onWUCompileECL(IEspContext &context, IEspWUCompileECLReques
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -9113,7 +9112,7 @@ bool CWsWorkunitsEx::onWUClusterJobQueueXLS(IEspContext &context, IEspWUClusterJ
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -9213,7 +9212,7 @@ bool CWsWorkunitsEx::onWUClusterJobQueueLOG(IEspContext &context,IEspWUClusterJo
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -9279,7 +9278,7 @@ bool CWsWorkunitsEx::onWUClusterJobXLS(IEspContext &context, IEspWUClusterJobXLS
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -9346,7 +9345,7 @@ bool CWsWorkunitsEx::onWUClusterJobSummaryXLS(IEspContext &context, IEspWUCluste
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -9438,7 +9437,7 @@ bool CWsWorkunitsEx::onWUGetDependancyTrees(IEspContext& context, IEspWUGetDepen
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
     return true;
     return true;
 }
 }
@@ -9492,7 +9491,7 @@ bool CWsWorkunitsEx::onWUListLocalFileRequired(IEspContext& context, IEspWUListL
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }
@@ -9616,7 +9615,7 @@ bool CWsWorkunitsEx::onWUAddLocalFileToWorkunit(IEspContext& context, IEspWUAddL
     }
     }
     catch(IException* e)
     catch(IException* e)
     {   
     {   
-        FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
+        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     }
    return true;
    return true;
 }
 }

+ 12 - 31
esp/smc/SMCLib/exception_util.hpp

@@ -114,47 +114,28 @@
 #define ECLWATCH_PSEXEC_NOT_INSTALLED           ECLWATCH_ERROR_START+94
 #define ECLWATCH_PSEXEC_NOT_INSTALLED           ECLWATCH_ERROR_START+94
 #define ECLWATCH_NO_WUID_SPECIFIED          ECLWATCH_ERROR_START+95
 #define ECLWATCH_NO_WUID_SPECIFIED          ECLWATCH_ERROR_START+95
 
 
-inline void FORWARDEXCEPTION(IException *e, unsigned codeNew)
+inline void FORWARDEXCEPTION(IEspContext &context, IException *e, unsigned codeNew)
 {
 {
     if (!e)
     if (!e)
         return;
         return;
 
 
-    StringBuffer eMsg;
+    time_t tNow;
+    struct tm timeStruct;
+    char timeString[32];
+    StringBuffer eMsg, eMsgDisplay;
+
     int err = e->errorCode();
     int err = e->errorCode();
     e->errorMessage(eMsg);
     e->errorMessage(eMsg);
     e->Release();
     e->Release();
 
 
+    context.setException(err);
+
     //set time stamp in the result for this machine
     //set time stamp in the result for this machine
-    time_t tNow;
     time(&tNow);
     time(&tNow);
-
-    char timeStamp[256];
-#ifdef _WIN32
-    struct tm * ltNow = gmtime(&tNow);
-    strftime(timeStamp, 32, "%m/%d/%y %H:%M:%S GMT", ltNow);
-#else
-    struct tm ltNow;
-    gmtime_r(&tNow, &ltNow);
-    strftime(timeStamp, 32, "%m/%d/%y %H:%M:%S GMT", &ltNow);
-#endif
-
-#if 0
-    if (err < ERRORID_UNKNOWN)
-    {
-        StringBuffer eMsg_Log, eMsg_Display;
-        eMsg_Log.appendf("%s: %s", timeStamp, eMsg.str());
-        eMsg_Display.appendf("%s: %s", timeStamp, ERRORMSG_INTERNAL);
-
-        ERRLOG(eMsg_Log.str()); //log original exception
-        throw MakeStringException(codeNew, eMsg_Display.str()); //Update message and display "" to indicate where the exception comes from
-    }
-    else
-#endif
-    {
-        StringBuffer eMsg_Display;
-        eMsg_Display.appendf("%s: %s", timeStamp, eMsg.str());
-        throw MakeStringException(err, "%s", eMsg_Display.str());
-    }
+    gmtime_r(&tNow, &timeStruct);
+    strftime(timeString, 32, "%Y-%m-%d %H:%M:%S GMT", &timeStruct);
+    eMsgDisplay.appendf("%s: %s", timeString, eMsg.str());
+    throw MakeStringException(err, eMsgDisplay.str());
         
         
     return;
     return;
 }
 }