-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Expected Behavior
When creating a RestClient, initialized with ThrowOnAnyError = true, I expect an exception to be thrown when a request fails, as per the documentation: Error Handling
Actual Behavior
No exception is thrown.
For sync requests, the exception is caught in ExecuteRequest, for async requests it's caught in GetStyleMethodInternalAsync. In both cases the exception is consumed and a HttpResponse with error info is returned. No exception gets thrown. Instead, the error response is returned, regardless of the value of ThrowOnAnyError.
Steps to Reproduce the Problem
A simple request against a non-existing endpoint shows the problem:
var req = new RestRequest("nonexisting");
var client = new RestClient("http://localhost:12345") { ThrowOnAnyError=true };
Assert.Throws<Exception>(() => client.Execute(req)); // Fails: no exception is thrown
Specifications
- Version: 106.11.7
- Platform: Windows x64
Metadata
Metadata
Assignees
Labels
No labels