Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Is there a system variable that indicates any of the FaultRule conditions succeeded?

Not applicable

To DRY up my fault handling code, I have factored the common error processing code into the DefaultFaultRule with a conditional test to assign a generic error if no other error has been assigned. So in each AssignMessage policy that assigns a fault response, I include:

    <AssignVariable>
        <Name>wf.fault_assigned</Name>
        <Value>true</Value>
    </AssignVariable>

So if any fault condition is true and the AssignMessage executes, the flag is set true. Then in the DefaultFaultRule I do this:

    <DefaultFaultRule name="default_fault_rule">
        <Step>
            <Name>calculate_error_values</Name>
        </Step>
        <Step>
            <Name>calculate_response_headers</Name>
        </Step>
        <Step>
            <Name>fault_generic_error</Name>
            <Condition>(wf.fault_assigned != "true")</Condition>
        </Step>
        <AlwaysEnforce>true</AlwaysEnforce>
    </DefaultFaultRule>

So if no fault response has yet been assigned, then the generic fault message is assigned. I'm wondering if there is a system variable that performs essentially the same operation so I can eliminate this repeating code in every fault AssignMessage policy. It seems it would be needed to know whether to execute the DefaultFaultRule or not (when AlwaysEnforce is not true).

Note that this value is also useful when reaching the PostClientFlow to be able to select logging policies, thus:

    <PostClientFlow name="PostClientFlow">
        <Request/>
        <Response>
            <Step>
                <Name>log_to_papertrail</Name>
                <Condition>(wf.fault_assigned != "true")</Condition>
            </Step>
            <Step>
                <Name>log_errors_to_papertrail</Name>
                <Condition>(wf.fault_assigned = "true")</Condition>
            </Step>
        </Response>
    </PostClientFlow>
1 7 583
7 REPLIES 7