Can we use faultrules tag in policies ?

Fault Handling documentation here says that fault rules can be attached to proxy or target default end points.
Attach fault rules to the following entities in an API proxy configuration: ProxyEndpoint: Enables fault handling for all errors that occur in the ProxyEndpoint request and response flows. TargetEndpoint: Enables fault handling for all errors that occur in the TargetEndpoint request and response flows.
It doesn't talk about attaching same to policies. Policy individual pages also doesn't talk about same explicitly. Check right side bar for tags in below example. 1056-screen-shot-2015-09-02-at-32939-pm.png But, Some of the examples in policy pages use same for example here,
 <LookupCache async="false" continueOnError="false" enabled="true" name="Lookup-Cache-1">
    <DisplayName>Lookup Cache 1</DisplayName>
    <FaultRules/>
    <Properties/>
    <CacheKey>
        <Prefix/>
        <KeyFragment ref=""/>
    </CacheKey>
    <!-- Omit this element if you're using the included shared cache. -->
    <CacheResource/>
    <Scope>Exclusive</Scope>
    <AssignTo>flowVar</AssignTo>
</LookupCache>
Is it a doc issue or fault rules are not supported on policies ? Cheers, Anil Sagar
Solved Solved
1 7 318
2 ACCEPTED SOLUTIONS

Today, FaultRules are not supported at the policy level, but only at the Endpoint level The policy schema contains a FaultRules element, but it is not used [might be in future]. We need to update the document to reflect this, Thanks,

View solution in original post

I added this note to the doc on fault rules: "When you create a policy in the Edge UI, it includes a <FaultRules/> tag. However, fault rules cannot be attached to individual policies at this time." Stephen

View solution in original post

7 REPLIES 7

Today, FaultRules are not supported at the policy level, but only at the Endpoint level The policy schema contains a FaultRules element, but it is not used [might be in future]. We need to update the document to reflect this, Thanks,

Thank you @Mukundha Madhavan for details. It helps. We need to update individual policy doc pages to avoid confusion.

I added this note to the doc on fault rules: "When you create a policy in the Edge UI, it includes a <FaultRules/> tag. However, fault rules cannot be attached to individual policies at this time." Stephen

@sgilson , Thank you for quick action. Can we also remove it from examples in individual policy pages ? For Example, here.

All set - it looks like all 4 cache policies listed that tag, but no other policies did. I have removed it from the caching policies. Stephen

Awesome, Thank you @sgilson

Not applicable

How about the FaultRules in each Step?

As per document I see FaultRules tag can be attached at the Step level. if a <FaultRules/> tag is present in the step, Apigee does not mind saving.

Good Example:

            <Step>
                <FaultRules/>
                <Name>RaiseFault_fault500</Name>
                <Condition>(request.queryparam.fault500 == "true")</Condition>
            </Step>

However, the following gives an error

            <Step>
                <FaultRules>
                    <FaultRule name="default">
                        <Step>
                           <Name>set400error</Name>
                        </Step>
                        <Condition>error.status.code == 500</Condition>
                    </FaultRule>
                </FaultRules>
                <Name>RaiseFault_fault500</Name>
                <Condition>(request.queryparam.fault500 == "true")</Condition>
            </Step>

Please confirm if my understanding is correct?