API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#API Connect
#Applicationintegration
#APIConnect
 View Only
  • 1.  Error handling in UDP

    Posted 02/03/25 11:08 AM

    Hi All,

    I need your inputs here. I have a pre-global policy with a UDP configured in it. For all incoming calls, this pre-global policy will call the UDP, and then the actual business API will be called.

    The issue is, when I use content.reject for some conditions to throw errors (and do not catch that error in the catch block), it stops the processing of UDP and API. However, when I use context.reject and try to catch that error for a customized response in the catch block (e.g., JavaScript error or bad request error), I catch that error and set a customized error response in message.body. The message is set, but it continues with the processing of the Business API after the UDP , which I do not want in this case.

    In case of any error in UDP, I want a customized error to be set and also stop the processing of UDP and Business API further.How can this be achieved?



    ------------------------------
    vijaya k k
    ------------------------------


  • 2.  RE: Error handling in UDP

    Posted 02/07/25 09:43 AM

    Hi Vijaya,

    If I understand your problem correctly you want to throw a message in you pre-global policy flow and generate a custom error message for this. You want to stop the processing and send the fault back to the consumer. The way I do this is a combination of the pre-global policy and the error policy. 

    In the pre policy you can throw a fault with  context.reject('MyFault','Something is wrong') and then in the error polcy you can catch this exception and create your custom fault message. 



    ------------------------------
    Jef Jansen
    Integration Architect
    IntegrationDesigners.com
    Kontich
    ------------------------------