This commit is contained in:
2020-07-21 19:32:50 +00:00
parent f94a4f4223
commit 336046b1d7
8 changed files with 39 additions and 32 deletions

View File

@@ -41,7 +41,7 @@ namespace AyaNova.Biz
//This handles general notification events not requiring a decision or tied to an object that are basically just a immediate message to the user
//e.g. ops problems, DefaultNotification, NotifyHealthCheck etc
//optional user id to send directly to them
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, long userId = 0)
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, Exception except = null, long userId = 0)
{
log.LogTrace($"AddGeneralNotifyEvent processing: [type:{eventType}, userId:{userId}, message:{message}]");
#if (DEBUG)
@@ -86,6 +86,11 @@ namespace AyaNova.Biz
//check subscriptions for event and send accordingly to each user
var subs = await ct.NotifySubscription.Where(z => z.EventType == eventType).ToListAsync();
//append exception message if not null
if (except != null)
message += $"\nException error: {ExceptionUtil.ExtractAllExceptionMessages(except)}";
foreach (var sub in subs)
{
//note flag ~SERVER~ means to client to substitute "Server" translation key text instead