How to handle Exception thrown by Backend?

When I am sending a request to backend. I am getting a 404 Not Found error. Please let me know how to catch the same and create a Custom Fault Response other than using Default Fault Handler.

I was using the following code but was unable to do it.

<Step> <Condition>response.error.code = 404 </Condition><Name>User-Not-present</Name> </Step>

Solved Solved
1 3 2,941
1 ACCEPTED SOLUTION

sgilson
Participant V

Here is an example in the doc for handling a 400 or 500. Use the same process to handle a 404:

http://apigee.com/docs/api-services/content/fault-handling#customhandlingofhttperrorcodesfromthetarg...

Stephen

View solution in original post

3 REPLIES 3

sgilson
Participant V

Here is an example in the doc for handling a 400 or 500. Use the same process to handle a 404:

http://apigee.com/docs/api-services/content/fault-handling#customhandlingofhttperrorcodesfromthetarg...

Stephen

Thanks Stephen... It helped to resolve the issue.

Not applicable

@GargiTalukdar

Create a raise fault policy as unattached policy. Mention it in Fault Rules. You can also specify the conditions when you have to invoke it. In that policy, you can mention your error code and custom message as you want.

Refer policy and go to section Creating Fault Rules

This will give you a fair idea how to do the fault handling.

Let me know.