MailWindow: Add try/catch block around document creation

This commit is contained in:
2024-03-02 18:57:03 +01:00
parent 9139557cc4
commit 376af72700

View File

@ -427,6 +427,7 @@ namespace Elwig.Windows {
var memberDocs = recipients.Select(m => new {
Member = m,
Docs = docs.SelectMany<SelectedDoc, GeneratedDoc>(doc => {
try {
if (doc.Type == DocType.Custom) {
return [new GeneratedDoc((string)doc.Details!)];
} else if (doc.Type == DocType.MemberDataSheet) {
@ -463,6 +464,10 @@ namespace Elwig.Windows {
} else {
throw new NotImplementedException("Invalid DocType");
}
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
return [];
}
}).ToList()
}).ToList();