Hi Mohamed,
The behavior you're seeing is as designed. The post-response global policy will be executed when there is not an error in your processing, either from your pre-request or your mainline API assembly. If you have an error at any point in time, then the post-error is executed. If you're doing something in your post-response that you'd also like done in your post-error, you'll need to add that processing to the post-error. Note that you must explicitly catch ForbiddenError, BadRequestError and UnauthorizedError in your post error as a default catch will not catch these specific preflow errors. As for your API assembly, if you catch an error there, you have effectively cleared the error, indicating that you are handling the error in the catch, and in this case your post-response global policy will be executed. The post-error global policy will execute if there is an uncaught error during your processing.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Wed March 29, 2023 04:35 PM
From: Mohamed Alkhaligy
Subject: Error global policy & post-response global policy
This might be a basic question, but we have this scenario and I do not know how global policies interact with each other.
In our scenario there's a GatewayScript that should always run in the post-response global policy and it was working perfectly fine. Up until now we have been using basic catches in each API, but now we want to include all common catches in the error global policy. What I have noticed is that now if an error was caught by the error global policy, the post-response script is no longer called. So, am I doing something wrong and the post-response should always run, or is it the other way around in which if an error is caught the post-response global policy will no longer run? do I have to copy the script in every catch in the error global policy? or is there some sort of configuration to control such behaviors?
------------------------------
Mohamed Alkhaligy
------------------------------