Could not get the Exception::Error Message to maintain log

Dear All,

I need to get the error message with below code.Please help me in this regard.

try

{

startLengthyOperation();

this.CashInPatientNew();

endLengthyOperation();

}

catch(Exception::Error)

{

How to get error message here.

}

catch(Exception::CLRError)

{

ex = ClrInterop::getLastException();

if (ex != null)

{

ex = ex.get_InnerException();

if (ex != null)

{

errorTxt = ex.get_Message();

errorStr = strFmt("%1 ", errorTxt);

}

}

}

Thanks & Regards,

Britto John Baskar.A

Is there anyway to do this friends?Please tell me.It’s little urgent.

Thanks & Regards,

Britto John Baskar.A

Try this:

SysInfoLogEnumerator infoLogEnum;
SysInfologMessageStruct infoMessageStruct;

infoLogEnum = SysInfoLogEnumerator::newData(infolog.infologData());

while(infoLogEnum.moveNext())
{
infoMessageStruct = SysInfologMessageStruct::construct(infoLogEnum.currentMessage());
info(infoMessageStruct );
}

Hi Vishal,

I have to place this code in catch block.is it as below?

catch(Exception::Error)

{

infoLogEnum = SysInfoLogEnumerator::newData(infolog.infologData());

while(infoLogEnum.moveNext())
{
infoMessageStruct = SysInfologMessageStruct::construct(infoLogEnum.currentMessage());
info(infoMessageStruct );
}

}

Hi Vishal,

First of all thank you for replying.

have i to place this code in catch block as below?

catch(Exception::Error)

{

infoLogEnum = SysInfoLogEnumerator::newData(infolog.infologData());

while(infoLogEnum.moveNext())
{
infoMessageStruct = SysInfologMessageStruct::construct(infoLogEnum.currentMessage());
info(infoMessageStruct );
}
}

Thanks…

Yes debug and check all the possible places where it can throw error. and track the error message from infologEnum.currentMessage() in String format.