Duplicate post made part of https://community.ibm.com/community/user/integration/discussion/gateway-script-error-and-exception-handling?ReturnUrl=%2fcommunity%2fuser%2fintegration%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3d2106cca0-a9f9-45c6-9b28-01a28f4ce947 was answered there.
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Wed September 13, 2023 06:07 AM
From: pratap vadlapati
Subject: Handle 400 Bad Request-One or more required API parameters are missing in the API request Globally with custom JSON
Hi
we tried to configure global-error policy, but we are facing issues and unable to capture 400 Bad request.
- Global error Policy is not triggering until we configure throw action in the API assembly Flow.Is this how it works?, I assume it should trigger for any error returned from API.
- Even if have throw action configured for specific 400 Bad Request Error, global-error-policy is not triggered.Currently its returning as below instead of custom json FYR: {
"httpCode": "400",
"httpMessage": "Bad Request",
"moreInformation": "One or more required API parameters are missing in the API request."
} - sample global error policy we configured as below. and i can see catch config in Datapower API Rule.
global-policy: 1.0.0
info:
name: sample-error-policy
title: Sample Error Policy
version: 2.0.0
gateways:
- datapower-api-gateway
assembly:
catch:
- errors:
- ConnectionError
- UnauthorizedError
- BadRequestError
- ForbiddenError
- SOAPError
execute:
- xslt:
version: 2.0.0
title: xslt
input: false
source: <xslt/> to return custom json
------------------------------
pratap vadlapati
------------------------------