Skip to content

Conversation

mbp
Copy link
Contributor

@mbp mbp commented Dec 2, 2013

This change is quite simple, When using the generic Execute overload, ErrorException was not set (even though ErrorMessage) was.

The following code gives me the ability to handle any exception occured - for example "Connection refused":

        var restClient = new RestClient(url);
        var response = restClient.Execute(new RestRequest());
        // response.ErrorException is set

However using the overload of Execute which takes a Dto to deserialize into, works differently:

        var restClient = new RestClient(url);
        var response = restClient.Execute<Dto>(new RestRequest());
        // response.ErrorException is not set

haacked added a commit that referenced this pull request Dec 2, 2013
Remember to map ErrorException along with other properties
@haacked haacked merged commit 4c32a14 into restsharp:master Dec 2, 2013
@haacked
Copy link
Contributor

haacked commented Dec 2, 2013

Thanks!
thumbs-up-computer-kid-gif

@Vyeche
Copy link

Vyeche commented Sep 24, 2015

The issue still exists for me.

public T Execute(RestRequest request) where T : new() {
...
var client = new RestClient {BaseUrl = baseUrl};
var response = client.Execute(request);
// response.ErrorException is not set
}

It won't properly set the error message, although I still see an error in the content response:
response = "StatusCode: InternalServerError, Content-Type: application/json; charset=utf-8, Content-Length: 80)"

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants