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