From a25e8096715c0d85abae7b6e168f8813107a09ae Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Mon, 14 Sep 2020 15:09:57 +0300 Subject: [PATCH] Extend try/catch in media downloading to OperationCanceledException Closes #372 --- DiscordChatExporter.Domain/Exporting/ExportContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DiscordChatExporter.Domain/Exporting/ExportContext.cs b/DiscordChatExporter.Domain/Exporting/ExportContext.cs index 6753ef7..7e23b4b 100644 --- a/DiscordChatExporter.Domain/Exporting/ExportContext.cs +++ b/DiscordChatExporter.Domain/Exporting/ExportContext.cs @@ -84,7 +84,10 @@ namespace DiscordChatExporter.Domain.Exporting return relativeFilePath; } - catch (HttpRequestException) + // Try to catch only exceptions related to failed HTTP requests + // https://github.com/Tyrrrz/DiscordChatExporter/issues/332 + // https://github.com/Tyrrrz/DiscordChatExporter/issues/372 + catch (Exception ex) when (ex is HttpRequestException || ex is OperationCanceledException) { // We don't want this to crash the exporting process in case of failure return url;