Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
megasuperlexa committed Dec 23, 2024
1 parent ea452af commit c659772
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ClickHouse.Client/ADO/ClickHouseConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,16 @@ internal static async Task<HttpResponseMessage> HandleError(HttpResponseMessage
activity.SetSuccess();
return response;
}
activity.SetStatus(ActivityStatusCode.Error, response?.ReasonPhrase ?? string.Empty);
var ex = new Exception($"Error '{response.StatusCode}' reading server response: {response.ReasonPhrase}");
string description = response?.ReasonPhrase ?? string.Empty;
activity?.SetStatus(ActivityStatusCode.Error, description);
var ex = new Exception($"Error '{response?.StatusCode}' reading server response: {description}");
try
{
await response.Content.LoadIntoBufferAsync(4096);
var stream = (MemoryStream)await response.Content.ReadAsStreamAsync();
var error = new StreamReader(stream).ReadToEnd();
ex = ClickHouseServerException.FromServerResponse(error, query);
activity.SetException(ex);
activity?.SetException(ex);
}
finally
{
Expand Down

0 comments on commit c659772

Please sign in to comment.