Proxy mode: Unhandled exception when target is not working #273

Closed
opened 2025-12-29 15:19:29 +01:00 by adam · 7 comments
Owner

Originally created by @LevYas on GitHub (May 17, 2020).

WireMock returns stack trace instead of a meaningful message, it is very misleading.
Repro: https://github.com/LevYas/WireMockNetRepro
2020-05-17 17_08_29-WireMockRepro (Debugging) - Microsoft Visual Studio

It would be very nice to return a message, saying that the target is not available.

Originally created by @LevYas on GitHub (May 17, 2020). WireMock returns stack trace instead of a meaningful message, it is very misleading. Repro: https://github.com/LevYas/WireMockNetRepro ![2020-05-17 17_08_29-WireMockRepro (Debugging) - Microsoft Visual Studio](https://user-images.githubusercontent.com/36070899/82152309-e6894d00-9868-11ea-85d3-52774ce1eb77.png) It would be very nice to return a message, saying that the target is not available.
adam added the bug label 2025-12-29 15:19:29 +01:00
adam closed this issue 2025-12-29 15:19:29 +01:00
Author
Owner

@StefH commented on GitHub (May 18, 2020):

Preview version WireMock.Net.1.2.10-ci-13352 on MyGet should fix this 500 error, please test.

@StefH commented on GitHub (May 18, 2020): Preview version `WireMock.Net.1.2.10-ci-13352` on MyGet should fix this 500 error, please test.
Author
Owner

@LevYas commented on GitHub (May 18, 2020):

Tested. For me, it doesn't return "No such host is known.", but "No connection could be made because the target machine actively refused it.":

< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
...
* HTTP error before end of send, stop sending
<
{"Status":"No connection could be made because the target machine actively refused it."}* Closing connection 0

Anyway, it's much better than a stack trace :D
But I think the test in your PR might not be stable.

@LevYas commented on GitHub (May 18, 2020): Tested. For me, it doesn't return "No such host is known.", but "No connection could be made because the target machine actively refused it.": ``` < HTTP/1.1 100 Continue < HTTP/1.1 500 Internal Server Error ... * HTTP error before end of send, stop sending < {"Status":"No connection could be made because the target machine actively refused it."}* Closing connection 0 ``` Anyway, it's much better than a stack trace :D But I think the test in your PR might not be stable.
Author
Owner

@StefH commented on GitHub (May 18, 2020):

I run the tests for netcore 3.1 and I noticed a difference there, so I just check on known.

@StefH commented on GitHub (May 18, 2020): I run the tests for netcore 3.1 and I noticed a difference there, so I just check on `known`.
Author
Owner

@LevYas commented on GitHub (May 18, 2020):

I also used netcore 3.1, but on Windows, maybe that's the reason

@LevYas commented on GitHub (May 18, 2020): I also used netcore 3.1, but on Windows, maybe that's the reason
Author
Owner

@StefH commented on GitHub (May 18, 2020):

OK, the difference is that I try to connect to a non-existing hostname.
And you try to connect to localhost (which exists) but nothing listens at port 5000.

@StefH commented on GitHub (May 18, 2020): OK, the difference is that I try to connect to a non-existing hostname. And you try to connect to localhost (which exists) but nothing listens at port 5000.
Author
Owner

@LevYas commented on GitHub (May 18, 2020):

Ah, sure, you are right, thanks.

@LevYas commented on GitHub (May 18, 2020): Ah, sure, you are right, thanks.
Author
Owner

@StefH commented on GitHub (May 18, 2020):

I'll merge to master. New NuGet will be released soon.

@StefH commented on GitHub (May 18, 2020): I'll merge to master. New NuGet will be released soon.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#273