Default fault role is not wotking

Not applicable

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:

7038-def-fault-rule.png

Any idea what should I do more to get the correct process?

0 2 208
2 REPLIES 2

sivanasimsetty
Participant II

@balassa

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

0 0 3

Not applicable

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/>
0 0 3
Top Labels in this Space
Top Solution Authors