I am getting some issue with setResponseCode service. We can use this service to set specific response code for APIs and working fine. But same service when using inside catch block its not working and always setting default response code as 500. Is there any way to overcome this step.
Please Note: in catch block after using setResponseCode we are using Exit-flow to mark service as failure.
Try the following: in the try-catch block just set a flag indicating whether an error occurred. Then set the response code as appropriate but do it not within the try-catch block.