Skip to content

Conversation

FrediKats
Copy link
Contributor

Description

fix #1511

RestClient property ThrowOnAnyError is not work correct becouse all exceptions are handled before this check:

try
{
    var http = ConfigureHttp(request);
                
    request.OnBeforeRequest?.Invoke(http);

    response = RestResponse.FromHttpResponse(getResponse(http, httpMethod), request);
}
catch (Exception ex)
{
    if (ThrowOnAnyError) throw;
                
    response.ResponseStatus = ResponseStatus.Error;
    response.ErrorMessage   = ex.Message;
    response.ErrorException = ex;
}

In getResponse we have:

catch (Exception ex)
{
    return ExtractErrorResponse(ex);
}

Purpose

This pull request is a:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

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.

ThrowOnAnyError does not throw
2 participants