When the target server returns an error, having an Apigee policy to handle that error prevents the API proxy from going into an error state in the target endpoint response and preventing the normal API proxy flow from continuing to the proxy endpoint.
  1. Add a policy with the AssignMessage type.
    A screen capture showing the Apigee policy with the AssignMessage type.
  2. Edit the target endpoint and add the new policy as a step in the default fault rule.

    For example:

    <DefaultFaultRule name="fault-rule">
         <Step>
              <Name>ReturnGenericError</Name>
         </Step>
    </DefaultFaultRule>
    A screen capture showing the default fault rule with the new policy added as a step.