Matt, Have a look in the Axapta developer's guide for the word 'try'. Or, you can search the AOT for the words try and catch. Regards, Anton "Matt" <matt1980@foodjam.com> wrote in message news:O8zMp$HwGHA.1888@TK2MSFTNGP03.phx.gbl...
I want to catch the exception msg that thrown to me.. wht is the class or method for that in C#, we always do in in the following way: try { //Some code here } catch (Exception msg) { MessageBox.Show(msg.Message); } how about in X++??
anton, cant find any help from the help file "Matt" <matt1980@foodjam.com> wrote in message news:O8zMp$HwGHA.1888@TK2MSFTNGP03.phx.gbl...
Hi Matt, You will have to get the message from the infolog. Also consider than zero or more that one message can be found depending how the exception was throw and if it was catch and throw again. static void GetExceptionMessage(Args _args) { int infoLines; SysInfoLogEnumerator infoLogEnum; SysInfologMessageStruct infoMessageStruct; ; infoLines = infolog.line(); try { print "before"; throw error("My Error"); print "after"; } catch(Exception::Error) { infoLogEnum = SysInfoLogEnumerator::newData(infolog.cut(infoLines + 1)); while(infoLogEnum.moveNext()) { infoMessageStruct = SysInfologMessageStruct::construct(infoLogEnum.currentMessage()); print infoMessageStruct.message(); } } pause; } -Ricardo Venegas [MSFT] -- This posting is provided "AS IS" with no warranties, and confers no rights "Matt" <matt1980@foodjam.com> wrote in message news:O8zMp$HwGHA.1888@TK2MSFTNGP03.phx.gbl...