Hy volks,
I'm trying to get in the defualt fault step, to test my app, but if I fail, the default case is not executing...
Here is my code:
<FaultRules> <FaultRule name="UnresolvedVariable"> <Step> <Name>Log-Errors</Name> </Step> <Step> <Name>Error-Handler-Invalid-Appsid</Name> </Step> <Condition>(execution.error.message Matches "xxx")</Condition> </FaultRule> <DefaultFaultRule name="default-fault"> <Step> <Name>Error-Handler-Default-Message</Name> </Step> </DefaultFaultRule>
And here is a trace scanshot:
Any idea what should I do more to get the correct process?
Please specify the below element under DefaultFault rule to execute the default fault rule.
<AlwaysEnforce>true</AlwaysEnforce>
For more info please refer the docs page.
Note: If the <DefaultFaultRule>
has the child element <AlwaysEnforce>true</AlwaysEnforce>
, the DefaultFaultRule is always executed, even if another FaultRule was executed as well. Any payload and/or headers set by a policy in the DefaultFaultRule get returned to the client, since it's the last to execute.
https://docs.apigee.com/api-platform/fundamentals/fault-handling
After some debuggimng, I recognised, I need to put the <DefaultFaultRule> tag out of the <FaultRules> Tag.
In practice:
I did wrong:
<FaultRules>// some other <FaultRule/><DefaultFaultRule/></FaultRules>
Correct:
<FaultRules>// some other <FaultRule/></FaultRules><DefaultFaultRule/>
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |