don't email for deployment-interrupted snapshot exceptions

This commit is contained in:
Collin M. Barrett 2018-08-21 12:41:03 -05:00
parent a646854695
commit f836b39da0

View file

@ -182,16 +182,22 @@ private async Task TrackException(Exception e)
private async Task SendExceptionEmail(Exception e)
{
var msg = new StringBuilder();
msg.AppendLine("FilterListId: " + list.Id);
msg.AppendLine("Exception:");
msg.AppendLine(e.Message);
msg.AppendLine(e.StackTrace);
msg.AppendLine(e.InnerException?.Message);
msg.AppendLine(e.InnerException?.StackTrace);
await emailService.SendEmailAsync("Snapshot Exception", msg.ToString());
if (!IsDeploymentInterrupted(e))
{
var msg = new StringBuilder();
msg.AppendLine("FilterListId: " + list.Id);
msg.AppendLine("Exception:");
msg.AppendLine(e.Message);
msg.AppendLine(e.StackTrace);
msg.AppendLine(e.InnerException?.Message);
msg.AppendLine(e.InnerException?.StackTrace);
await emailService.SendEmailAsync("Snapshot Exception", msg.ToString());
}
}
private static bool IsDeploymentInterrupted(Exception e) =>
e.Message.Contains("Failed to read the result set.");
private void TrackExceptionInApplicationInsights(Exception e)
{
telemetryClient.TrackException(e);