FaultRules option in a policy

Not applicable
There is a <FaultRules> tag in each policy , lets take a javascript policy. What is the use of this? I could see that , faultRules can be set only for proxy and target end points and not for a policy. is it true? in case if i want to handly faults on policy level , is there any option for it?
Solved Solved
0 6 678
1 ACCEPTED SOLUTION

Dear @Arun Velaayudhan Ganesan ,

Welcome to Apigee Community 🙂

As far as i know, FaultRules can be only set for proxy and target end points as per documentation here. Each policy defines default fault names / error codes which can be generated due to various things. These can be attached to proxy & target endpoints so that faults will be handed appropriately. See below,

Adding policies to a fault rule & Handling Faults :

While you can put any policy in the fault rule, you commonly use the Assign Message policy. Use the Assign Message policy to generates a custom response message for an error condition. Assign Message enables you to configure an HTTP response with payload, HTTP status code, headers, and reason phrase elements. A policy used in a fault rule is typically not used in the normal flow pipeline. Therefore, when using the Edge UI to create a policy for a fault rule, select the plus sign, "+", next to "Policies" in the UI to add the policy.

<FaultRules> tag is like creating a rule to handle faults. A rule can ask a Assign Message Policy to construct a payload that can be send back to client using <Step> tag. Faults can be automatically generated by polices (error codes) or a fault can be manually generated using Raise Fault policy.

Cheers,

Anil Sagar

View solution in original post

6 REPLIES 6

Dear @Arun Velaayudhan Ganesan ,

Welcome to Apigee Community 🙂

As far as i know, FaultRules can be only set for proxy and target end points as per documentation here. Each policy defines default fault names / error codes which can be generated due to various things. These can be attached to proxy & target endpoints so that faults will be handed appropriately. See below,

Adding policies to a fault rule & Handling Faults :

While you can put any policy in the fault rule, you commonly use the Assign Message policy. Use the Assign Message policy to generates a custom response message for an error condition. Assign Message enables you to configure an HTTP response with payload, HTTP status code, headers, and reason phrase elements. A policy used in a fault rule is typically not used in the normal flow pipeline. Therefore, when using the Edge UI to create a policy for a fault rule, select the plus sign, "+", next to "Policies" in the UI to add the policy.

<FaultRules> tag is like creating a rule to handle faults. A rule can ask a Assign Message Policy to construct a payload that can be send back to client using <Step> tag. Faults can be automatically generated by polices (error codes) or a fault can be manually generated using Raise Fault policy.

Cheers,

Anil Sagar

Thank you Anil. i have read somewhere that , <FaultRules> Tag in each policy can help us to jump to a policy mentioned in this tag ( similar to goto in c ) . is this true?

It's not true, As a practice faultRules tag used in proxy & target end points.

ok. Thanks Anil 🙂

Anytime 🙂 You can also click on Accept link below the answer if you find answer resolves your question. That will help others looking for same solution and highlights best answer out of others. Thank you.

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