DefaultFaultRule is not handle when an error ocurrs inside raiseFault

Supose my proxyendpoint looks like :

   <DefaultFaultRule name="GenericFaultHandler">
        <Step>
            <Name>debug</Name>
        </Step><AlwaysEnforce>true</AlwaysEnforce>  

   </DefaultFaultRule>

Then inside raiseFault i make a mistake like:

<FaultResponse>
        <Set>
            <Headers/>
          <Payload contentType="application/json" variablePrefix="$" variableSuffix="#">
          {"error":{"statusCode":$_statusCode#,"code":"E01","message":"$_message#","developerMessage":"$_developerMessage#","_debug":$_errorDebug#
          }}</Payload>
            <StatusCode>{_statusCode}m</StatusCode>
            <ReasonPhrase>{_reasonPhrase}</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>
	

StatusCode throws NumberFormatExceptions but my "debug" policy is never executed...

Solved Solved
0 7 305
1 ACCEPTED SOLUTION

ha ok, I think the problem is

"If a fault rule other than the default fault rule invokes a Raise Fault policy, the default fault rule does not execute."

I found it in the doc http://apigee.com/docs/api-services/content/fault-handling

--

For all other errors in your proxy flow debug would have executed. Since its already RaiseFault - it skipped the 'debug' policy in FaultRule.

View solution in original post

7 REPLIES 7

are you trying to catch fault within the fault rule?

If there is a fault in your Proxy flow, your debug policy should have executed. are you seeing any errors?

Yes i'm trying to debug all the exceptions in the api, and the policy is never executed when raiseFault fails when i put "string" insideStatusCode

ha ok, I think the problem is

"If a fault rule other than the default fault rule invokes a Raise Fault policy, the default fault rule does not execute."

I found it in the doc http://apigee.com/docs/api-services/content/fault-handling

--

For all other errors in your proxy flow debug would have executed. Since its already RaiseFault - it skipped the 'debug' policy in FaultRule.

Include the <AlwaysEnforce> element in the <DefaultFaultRule> tag to execute the default fault rule for every error, even if another fault rule has already been executed. The default fault rule is always the last fault rule to execute:

yes, I understand the confusion. I think its not applicable for the RaiseFault policy. You could easily test this by having a different policy throw an error [for eg, APIKeyValidation or Quota]

I will anyways check with our product team to confirm this behavior

I have updated that line to now say:

"If a fault rule other than the default fault rule invokes a Raise Fault policy, the default fault rule does not execute, even if the <AlwaysEnforce> element in the <DefaultFaultRule> tag is true."

thanks i will double check all the variables using inside RaiseFault