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

Fault being raised while executing a raise fault policy

Not applicable

I have an issue where I am raising my own custom fault coming out of a Java Callout that sets a variable, jwt_isValid, if the fault occurs. The RaiseFault policy gets triggered, however upon execution, there is a fault while trying execute the RaiseFault policy which eventually gets handled by my default handler. I'd like to know why this second fault is occurring.

Here is the code for my preflow where it gets triggered:

            <Step>
                <Name>RaiseFault401InvalidToken</Name>
                <Condition>jwt_isValid="false"</Condition>
            </Step>

Here is the policy itself:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="RaiseFault401InvalidToken">
    <DisplayName>RaiseFault.401InvalidToken</DisplayName>
    <Properties/>
    <FaultResponse>
        <Set>
            <Headers/>
            <Payload contentType="application/json" variablePrefix="@" variableSuffix="#">{"exceptions":[{"type": "E","code": "401","message": "Invalid Token","detail": "details"}]}</Payload>
            <StatusCode>401</StatusCode>
            <ReasonPhrase>Invalid Token</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>

And here is the trace table output for the step when it fails:

Variables Read and Assigned

raisefault.failed true
raisefault.RaiseFault401InvalidToken
apigee.edge.execution
messageid *****_CVAHK7MOO_RouterProxy-10-46_2

Error Headers

Content-Type

Error Content

Body

Properties

action ABORT
stepDefinition-async false
internal false
stepDefinition-type raisefault
expression (jwt_isValid equals "false")
type RaiseFaultExecution
enforcement request
stepDefinition-continueOnError false
expressionResult true
stepDefinition-displayName RaiseFault.401InvalidToken
stepDefinition-name RaiseFault401InvalidToken
stepDefinition-enabled true
result false
error Raising fault. Fault name : RaiseFault401InvalidToken
type ErrorPoint
state PROXY_REQ_FLOW
error.class com.apigee.kernel.exceptions.spi.UncheckedException
Identifier fault
Solved Solved
0 5 2,691
1 ACCEPTED SOLUTION

Hi rj.walsh,

If you are using DefaultFaultRule to check unhandled exception, could you please let me know how you have configured it.

View solution in original post

5 REPLIES 5
Top Solution Authors