Skip to content

Commit 327587f

Browse files
georgendpeombwa
andauthored
Handle case where network is down or the endpoint is unreachable making ResponseMessage null. (#712)
Earlier behavior would suppress network errors. Co-authored-by: Peter Ombwa <[email protected]>
1 parent 4af3b18 commit 327587f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/Custom/Module.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ private async Task Finally(string id, CancellationToken cancellationToken, Func<
8585
using (Extensions.NoSynchronizationContext)
8686
{
8787
var eventData = EventDataConverter.ConvertFrom(getEventData());
88+
//Handle case where network is down or the endpoint is unreachable
89+
//making ResponseMessage null
90+
//https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/700
91+
if (eventData.ResponseMessage == null)
92+
{
93+
return;
94+
}
8895
var responseFormatter = new HttpMessageFormatter(eventData.ResponseMessage as HttpResponseMessage);
8996
var responseString = await responseFormatter.ReadAsStringAsync();
9097
await signal(Events.Debug, cancellationToken, () => EventFactory.CreateLogEvent(responseString));

0 commit comments

Comments
 (0)