protected ElasticsearchResponse <T> HandleAuthenticationException <T>(TransportRequestState <T> requestState, ElasticsearchAuthenticationException exception) { if (requestState.ClientSettings.ThrowOnElasticsearchServerExceptions) { throw exception.ToElasticsearchServerException(); } var response = ElasticsearchResponse.CloneFrom <T>(exception.Response, default(T)); response.Request = requestState.PostData; response.RequestUrl = requestState.Path; response.RequestMethod = requestState.Method; return(response); }