Azure / Azure/azure-sdk-tools

[Test-Proxy] Explicitly handle some well-known exceptions during `Record`, return easily parsable errors to clients

Open
#3,114 0 comments 0 reactions 1 assignee Claimed by @scbedd View on GitHub
Central-EngSys Test-Proxy
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

[Teams thread for context](https://teams.microsoft.com/l/message/19:b7c3eda7e0864d059721517174502bdb@thread.skype/1649456929698?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&parentMessageId=1649456929698&teamName=Azure%20SDK&channelName=Test-Proxy%20-%20Questions%2C%20Help%2C%20and%20Discussion&createdTime=1649456929698)

We are seeing a failure during a test that is designed to fail. Specifically, when going after a non-existent servicebus.

Per @mikeharder

> To the actual question, the live test gets ServiceRequestError: getaddrinfo failed, because the python HTTP client tries to perform a DNS lookup on nonexist.servicebus.windows.net and it fails.

And given that this is handled internal to the test proxy, we're giving back exception information that makes the above error opaque to the client side.

Need to handle some cases explicitly such that clients can easily recognize each class of error. Starting with the getaddrinfo failed.

```
try {
var upstreamResponse = await client.SendAsync(upstreamRequest).ConfigureAwait(false);
}
catch (HttpResponseError e) {
if (e.Message.Contains("Name does not resolve")) {
throw new HttpException(HttpStatusCode.BadRequest, $"DnsLookupFailure");
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.