public void Dispose() { if (!_traceEnabled || this._result == null) { return; } if (_result.Success) { Trace.TraceInformation("NEST {0} {1} ({2}):\r\n{3}" , _result.RequestMethod , _result.RequestUrl , _stopwatch.Elapsed , _result ); } else { Trace.TraceError( "NEST {0} {1} ({2}):\r\n{3}" , _result.RequestMethod , _result.RequestUrl , _stopwatch.Elapsed , _result.ToString() ); } }
/// <summary> /// Check that a call to Elasticsearch was successfull. /// </summary> /// <param name="response">Response from call to Elasticsearch.</param> /// <exception cref="Exception">Thrown if call to Elasticsearch was not successfull.</exception> private void CheckResponse <T>(ElasticsearchResponse <T> response) { if (response.HttpStatusCode != 200) { throw new Exception("Call to Elasticsearch failed." + " Response: " + response.ToString().Substring(0, Math.Min(response.ToString().Length, 800))); } }
public ElasticException(ElasticsearchResponse <VoidResponse> response) : base(response.ToString() + "\n" + (response.DebugInformation ?? string.Empty) + "\n" + (response.OriginalException?.ToString() ?? string.Empty), response.OriginalException ?? new Exception()) { this.response = response; }