Fault Handling - Trigger Errors - Raise Fault Policy is not working as expected

Hi @Anil Sagar,

I am following your below video: Apigee Edge - 4MV4D - Fault Handling - Trigger Errors - Raise Fault Policy - S17E03.

But what i have seen is that it is invoking raise fault policy everytime even when i am giving less than 3 query params.

<PreFlow name="PreFlow"> 
  <Request> 
    <Step>
      <Name>RF-CheckQueryParams</Name> 
      <Condtion>(request.queryparams.count GreaterThanOrEquals 4)</Condtion> 
    </Step> 
  </Request> 
  <Response/>
</PreFlow>

My policy looks like this:

<RaiseFault async="false" continueOnError="false" enabled="true" name="RF-CheckQueryParams"> 
  <DisplayName>RF-CheckQueryParams</DisplayName> 
  <Properties/> 
  <FaultResponse> 
    <Set> 
      <Headers/> 
      <Payload contentType="text/plain">More than 3 QueryParams not allowed</Payload> 
      <StatusCode>400</StatusCode> 
      <ReasonPhrase>Bad Request</ReasonPhrase> 
    </Set> 
  </FaultResponse> 
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> 
</RaiseFault>

Please check and let me know if i am doing something wrong here.

Your videos are very helpful for beginners.

Regards

Saransh Tiwari

Solved Solved
0 3 644
1 ACCEPTED SOLUTION

You have a typo in the name of the Condition element. In your configuration, it is spelled Condtion . (missing i)

You need Condition.

  <PreFlow name="PreFlow">
    <Request>
   <Step>
      <Name>RF-CheckQueryParams</Name>
      <Condition>request.queryparams.count > 3</Condition>
   </Step>
    </Request>
    <Response>
       ...

View solution in original post

3 REPLIES 3

You have a typo in the name of the Condition element. In your configuration, it is spelled Condtion . (missing i)

You need Condition.

  <PreFlow name="PreFlow">
    <Request>
   <Step>
      <Name>RF-CheckQueryParams</Name>
      <Condition>request.queryparams.count > 3</Condition>
   </Step>
    </Request>
    <Response>
       ...

Thanks @Dino

I didn't noticed it. Silly Mistake 😕

Yes. It would be nice if the validation could find such errors and throw a fault in that case, to let you know "Condtion" is not a valid element.

I've raised a bug on that behavior. b/110201514