Search code examples
apigee

Apigee fault handling for CLASSIFICATION_FAILURE


In Apigee, can fault handling - specifying a FaultRule and a RaiseFault policy be used to handle and provide a custom message for:

{
    "fault": {
        "faultstring": "Not Found",
        "detail": {
            "errorcode": "CLASSIFICATION_FAILURE"
        }
    }
}

If this can be done, should the 'Condition' for the fault rule be 'fault.name = "CLASSIFICATION_FAILURE"'? I tried this and it is not working.


Solution

  • CLASSIFICATION_FAILURE is a system level failure to find an API Proxy for the given URL/URI. The request will not even reach the API proxy(hence the policies) - which is the precise complaint by the system. So you do not want to handle an error like that.

    Another way to approach this case is to have a catch all API proxy with basepath /** which will be invoked when there is no specific URL match. You can generate a custom message in this proxy - this can be the message you wanted to send across in case of classification failure.