Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Error handling in AIF service.

$
0
0

Hi, 

I'm trying to do an exception handling in my code for a custom service which creates PO in AX.

But seems I've no control in handling it by try catch block. 

Here is my scenario, I have PO with 5 lines to be created, and even if my 3rd line thrown error on creation, I should be able to skip the line, log the message and create the rest of the lines.

while(purchLinesEnum.moveNext())//List enumerator
{
    //Contract class which holds the details for PO lines
    contractImp = purchLinesEnum.current();
    try
    {
        //A method which creates PO line, by using PurchLine.createLine method
        this.createPurchLine(purchTable,contractImp,inventLocation);
    }
    catch
    {
        ret = false; //A Boolean variable which should be set to false on error.
    }
}

Note: I have no transaction pair written outer the try catch block.

For this code, I have an exception returned to caller as below,

I try to debug the code, which resulted as below,

Could anyone help me to understand whats happening here. 

Thanks in Advance,

Abida


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>