Skip to content

Commit

Permalink
Added responseStream to the exception and log info when endpoint is busy
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasSort committed Aug 27, 2024
1 parent cbd457c commit 32ae96d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ODataSourceReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -606,7 +605,7 @@ private bool HandleRequest(string url, string loggerInfo, IDictionary<string, st
_logger?.Info($"This is retry {retryCounter} out of 2");
HandleRequest(url, loggerInfo, headers, retryCounter);
}

return false;
}
}
Expand Down Expand Up @@ -722,13 +721,16 @@ void HandleResponse(Stream responseStream, HttpStatusCode responseStatusCode, Di
}
else
{
using var stream = new StreamReader(responseStream);
var streamResponse = stream.ReadToEnd();

if (_failJobOnEndpointIsBusy)
{
throw new WebException($"{checkUrl} returned the HttpStatusCode of: '{responseStatusCode}' ");
throw new WebException($"{checkUrl} returned: {streamResponse} with the HttpStatusCode of: '{responseStatusCode}' ");
}
else
{
_logger?.Info($"{checkUrl} returned the HttpStatusCode of: '{responseStatusCode}' ");
_logger?.Info($"{checkUrl} returned: {streamResponse} with the HttpStatusCode of: '{responseStatusCode}' ");
}
}
}
Expand Down

0 comments on commit 32ae96d

Please sign in to comment.