in src/Amazon.CloudWatch.EMF/Environment/ResourceFetcher.cs [35:66]
private string ReadResource(Uri endpoint, string method)
{
try
{
var httpWebRequest = GetHttpWebRequest(endpoint, method);
var httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode == HttpStatusCode.OK)
{
return GetResponse(httpWebResponse);
}
else if (httpWebResponse.StatusCode == HttpStatusCode.NotFound)
{
throw new EMFClientException("The requested metadata is not found at " + httpWebRequest.RequestUri.AbsolutePath);
}
else
{
HandleErrorResponse(httpWebResponse);
}
}
catch (Exception e)
{
_logger.LogDebug(
"An IOException occurred when connecting to service endpoint: "
+ endpoint
+ "\n Attempting to reconnect.");
throw new EMFClientException("Failed to connect to service endpoint: ", e);
}
return string.Empty;
}