no-more-circle-autorisation-to-file

This commit is contained in:
Paul Schneider
2021-06-03 18:21:31 +01:00
parent f3d3a7e575
commit 6ae7333dbb
17 changed files with 2892 additions and 795 deletions

View File

@ -21,6 +21,13 @@ using Yavsc.Server.Settings;
namespace cli.Services
{
public class NoMaillingTemplateException : Exception
{
public NoMaillingTemplateException(string templateCode) : base ($"No template found under id {templateCode}.")
{
}
}
public class EMailer
{
@ -74,7 +81,7 @@ namespace cli.Services
var templateInfo = dbContext.MailingTemplate.FirstOrDefault(t => t.Id == templateCode);
if (templateInfo==null) throw new Exception($"No template found under id {templateCode}.");
if (templateInfo==null) throw new NoMaillingTemplateException(templateCode);
logger.LogInformation($"Using code: {templateCode}, subject: {subtemp} ");
logger.LogInformation("And body:\n"+templateInfo.Body);
using (StringReader reader = new StringReader(templateInfo.Body))