none
Save all details error in Exception Block of BizTalk RRS feed

  • Question

  • 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?


    Prakash

    Thursday, January 22, 2015 10:00 AM

Answers

  • 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


    Please mark as answer or vote as helpful if my reply does



    Thursday, January 22, 2015 10:20 AM
    Moderator

All replies

  • 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


    Please mark as answer or vote as helpful if my reply does



    Thursday, January 22, 2015 10:20 AM
    Moderator
  • 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.


    Greetings,HTH
    Naushad Alam

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
    alamnaushad.wordpress.com

    Thursday, January 22, 2015 11:04 AM
    Moderator
  • 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); 
                }
            }

    Thursday, January 22, 2015 11:31 AM
    Moderator