How to set response format for errors coming out of apigee router

We have a set of virtual host aliases defined for a given organization. When a request is made with the right virtual host and by the use of any interceptor if the host name in the header is changed to something else then Apigee sends out a response in the format below

{ "fault": { "faultstring": "Classification failed for host: google.com url: /", "detail": { "code": "CLASSIFICATION_FAILED" } } }

If i wanted to standardize this error format to say something like "error":"The hostname doesnt match with virtual hosts configured" how would i be able to do that?

I noticed that these errors are not captured on either message processor or router logs and having a default error proxy on a given organization doesnt help me either

Thanks,

Vednath

1 2 361
2 REPLIES 2

Hi @vednath pittala,

You can utilise a RaiseFault or AssignMessage policy to standardise the error formats. Further if you want to standardise the formats all over the api proxies, common faults can be accessed from flow fragments.

Please refer to proxy-dependency-maven-plugin

Not applicable

Hello @vednath pittala, @Aswin Segu

If the request is not coming to the Message Processor (and you cant find it in trace), then that means the call is not hitting the API layer (where we have our customised error handling) and being rejected before hand by Underlying Apigee Layer.

If this is the case, then, I do not think that it is possible to apply your customised error message.

Hope this helps.!