---
title: Creating an error handling policy in Apigee
description: 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. If the API proxy enters an error state, the normal API proxy flow can't continue to the proxy endpoint.
component: pingaccess
version: 8.2
page_id: pingaccess:agents_and_integrations:pa_creating_an_error_handling_policy_in_apigee
canonical_url: https://docs.pingidentity.com/pingaccess/9.1/agents_and_integrations/pa_creating_an_error_handling_policy_in_apigee.html
llms_txt: https://docs.pingidentity.com/pingaccess/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: August 11, 2025
superseded_by: https://docs.pingidentity.com/pingaccess/9.1/agents_and_integrations/pa_creating_an_error_handling_policy_in_apigee.html
section_ids:
  about-this-task: About this task
  steps: Steps
---

# Creating an error handling policy in Apigee

## About this task

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. If the API proxy enters an error state, the normal API proxy flow can't continue to the proxy endpoint.

## Steps

1. Add a policy with the **AssignMessage** type.

   ![A screen capture showing the Apigee policy with the AssignMessage type.](_images/alu1654900669925.png)

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.](_images/zbu1654901094979.png)
