I think this comment from @sgilson is correct: “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 element in the tag is true.”
This is used in the pattern described here an-error-handling-pattern-for-apigee-proxies
@Benjamin Goldman In terms of your needs, you could ask teams to follow this pattern and have your centralized, default error handling in the default fault rule.
We’re using this pattern - we set the continueOnError flag to true for policies that we want to fall into this error handling.
As a simplified example
....
<Step>
<Name>VerifyAPIKey</Name>
</Step>
<Step>
<Name>AssignMessage.ErrorType.InvalidApiKey</Name>
<Condition>verifyapikey.VerifyAPIKey.failed="true"</Condition>
</Step>
<Step>
<Name>RaiseFault.GoToFaultRules</Name>
<Condition>custom.error.type != NULL</Condition>
</Step>
...
In the above example,
- VerifyAPIKey has continueOnError set to true.
- AssignMessage.ErrorType.InvalidApiKey simply sets a value on the custom.error.type variable (e.g. invalid_key)
- RaiseFault.GoToFaultRules doesn’t have any settings. Its purpose is to trigger the fault rules
From that point the pattern described in an-error-handling-pattern-for-apigee-proxies takes effect where a fault rule would have a condition
<Condition>custom.error.type = "invalid_key"</Condition>
The policy in the fault rule with the condition above, sets variables (via an AssignMessage policy, not a RaiseFault) and then as per the pattern you fall into the DefaultFaultRule where you can do any centralized tasks such as logging, or formatting of payloads, status codes and so on.
This way many teams don’t have to have custom RaiseFault policies. They’d have the setting of a variable that determines which fault rule to execute coupled with a generic, (essentially) empty RasieFault.GoToFaultRules.
You could then not only keep the DefaultFaultRule centralized but also, if you wished, the specific FaultRules.
On top of this we do have a “Common API” set of flow fragments but we have a remote team about to start that is going to make this difficult - no maven and possibly not the same SCM.
The drawback to this pattern is that there is potential for an explosion in the number of policies and I find that the readability of the endpoint is reduced.