When ContinueOnError is set to false in RaiseFault Policy,the Raisefault policy creates output which is defined in the <Payload>
<FaultResponse> <Set> <Headers> </Headers> <Payload contentType="application/json" variablePrefix="@" variableSuffix="#">{"status" : "401", "message" : "You are not authorized"}</Payload> <StatusCode>401</StatusCode> <ReasonPhrase>{fault.name}</ReasonPhrase> </Set> </FaultResponse>
But when ContinueOnError is set to True in RaiseFault Policy,the Raisefault policy just passes the fault produced by APIGEE and does not seem to customise the error payload.
"fault":{"faultstring":"Failed to resolve API Key variable request.header.X-AMEX-API-KEY","detail":{"errorcode":"steps.oauth.v2.FailedToResolveAPIKey"}}}
Is this expected behaviour?
Solved! Go to Solution.
Looks like you have a VerifyAPIKey followed by RaiseFault policy
<Step> <Name>VerifyAPIKey</Name> </Step> <Step> <Name>RaiseFault</Name> </Step>
so, to customize error of apikey failure - you need to
1) set continueOnError="true" for VerifyAPIKet policy
2) set a condition for RaiseFault
<Step> <Name>VerifyAPIKey</Name> </Step> <Step> <Condition>verifyapikey.{policy_name}.failed=true</Condition> <Name>RaiseFault</Name> </Step>
Looks like you have a VerifyAPIKey followed by RaiseFault policy
<Step> <Name>VerifyAPIKey</Name> </Step> <Step> <Name>RaiseFault</Name> </Step>
so, to customize error of apikey failure - you need to
1) set continueOnError="true" for VerifyAPIKet policy
2) set a condition for RaiseFault
<Step> <Name>VerifyAPIKey</Name> </Step> <Step> <Condition>verifyapikey.{policy_name}.failed=true</Condition> <Name>RaiseFault</Name> </Step>
Thankyou @Mukundha Madhavan