# Handling the response when Hoverfly cannot match

You will notice that when Hoverfly cannot match you will get a 502 Bad Gateway along with a detailed Hoverfly Error in the response Body.

<figure><img src="/files/D3N105CUwApim0ncnvWy" alt=""><figcaption></figcaption></figure>

This is good for debugging, but when you are running the simulations in a live environment you might want to replace this with a more graceful response that won't break your consuming system.

One approach to dealing with this is to create a "catch all" request/response pair and have it return an appropriate response code and maybe a JSON error that your front end can deal with, for example a 400 and some JSON in the error format you use. To configure this set the matcher's HTTP Verb to ALL, and do not set any other matchers in that endpoint. Then this will match if none of the other matchers are successful in catching the request, and always return something that you control.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloud.hoverfly.io/create-simulations/configuring-request-matchers/handling-the-response-when-hoverfly-cannot-match.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
