Save all details error in Exception Block of BizTalk

In orchestration A,I make a Exception Block ,created a System.Exception object and saved Exception Error in a string and checking it in admin console.

In my orchestarion, I got amount value from a element Amount, used a custom xslt and in that custom xslt, I used a C# function for desired calculation for the value of amount.

Now when,input string of amount is not in a correct format then a error is saved regarding mapping  as follows:

Transformation failed for Map A.

But the actual error is as follows:

input string was not in a correct format.

How can I get this error in  exception handler block?

January 22nd, 2015 1:00pm

Hi Prakash,

Like you have mentioned that you are using Custom XSLT, my advice will be that you can raise an exception from within an XSLT template, based on the value.

<xsl:message terminate="yes">Custom error text</xsl:message>

This will cause the XSLT engine to stop processing immediately, and raise an exception.   This exception, including the custom error text contained within the message segment, can be caught in the BizTalk Orchestration engine by explicitly catching an exception of type 

Microsoft.XLANGS.BaseTypes.TransformationFailureException.

Refer: Biz Talk : How To : Throw Custom Exception in Map

For step-by-step explanation on this refer: Flowing clear error messages from transforms

Rachit

Free Windows Admin Tool Kit Click here and download it now
January 22nd, 2015 1:20pm

You need to  iterate through all the inner exceptions in order to catch the exact error from the map. I would suggest you to follow Handling custom exceptions thrown from BizTalk maps blog post and you can get your idea from there. I guess this is what you want to achieve.

I hope this helps.

January 22nd, 2015 2:04pm

I used a C# function for desired calculation for the value of amount.

Now when,input string of amount is not in a correct format then a error is saved regarding mapping  as follows:

What you need to do is change how you 'handle' this case in you C# function.

        public static MySuperFunction(string MyValue)
        {
            double MyDouble;

            if(double.TryParse(MyValue, out MyDouble))
            {
                return [Result of your calculation];
            }
            else
            {
                throw new ArgumentException("MyValue passed to MySuperFunction was invalid. " + MyValue); 
            }
        }

Free Windows Admin Tool Kit Click here and download it now
January 22nd, 2015 2:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics