Skip to content

Commit

Permalink
Fixed a bug where the default formatter couldn't handle events with e…
Browse files Browse the repository at this point in the history
…mpty message or source.
  • Loading branch information
niemyjski committed Feb 12, 2024
1 parent 36ba850 commit 84efc2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public override MailMessageData GetEventNotificationMailMessageData(PersistentEv
if (isCritical)
notificationType = String.Concat("Critical ", notificationType.ToLowerInvariant());

string subject = String.Concat(notificationType, ": ", messageOrSource).Truncate(120);
string subject = String.IsNullOrEmpty(messageOrSource)
? notificationType
: String.Concat(notificationType, ": ", messageOrSource).Truncate(120);

var data = new Dictionary<string, object?>();
if (!String.IsNullOrEmpty(ev.Message))
data.Add("Message", ev.Message.Truncate(60));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Exceptionless.Core.Models;
using Exceptionless.Core.Models;
using Microsoft.Extensions.Logging;

namespace Exceptionless.Core.Plugins.Formatting;
Expand All @@ -14,6 +14,8 @@ public SummaryData GetStackSummaryData(Stack stack)
{
foreach (var plugin in Plugins.Values.ToList())
{
using var _ = _logger.BeginScope(s => s.Property("PluginName", plugin.Name));

try
{
var result = plugin.GetStackSummaryData(stack);
Expand All @@ -36,6 +38,8 @@ public SummaryData GetEventSummaryData(PersistentEvent ev)
{
foreach (var plugin in Plugins.Values.ToList())
{
using var _ = _logger.BeginScope(s => s.Property("PluginName", plugin.Name));

try
{
var result = plugin.GetEventSummaryData(ev);
Expand All @@ -58,6 +62,8 @@ public string GetStackTitle(PersistentEvent ev)
{
foreach (var plugin in Plugins.Values.ToList())
{
using var _ = _logger.BeginScope(s => s.Property("PluginName", plugin.Name));

try
{
string? result = plugin.GetStackTitle(ev);
Expand All @@ -80,6 +86,8 @@ public MailMessageData GetEventNotificationMailMessageData(PersistentEvent ev, b
{
foreach (var plugin in Plugins.Values.ToList())
{
using var _ = _logger.BeginScope(s => s.Property("PluginName", plugin.Name));

try
{
var result = plugin.GetEventNotificationMailMessageData(ev, isCritical, isNew, isRegression);
Expand All @@ -102,6 +110,8 @@ public SlackMessage GetSlackEventNotificationMessage(PersistentEvent ev, Project
{
foreach (var plugin in Plugins.Values.ToList())
{
using var _ = _logger.BeginScope(s => s.Property("PluginName", plugin.Name));

try
{
var message = plugin.GetSlackEventNotification(ev, project, isCritical, isNew, isRegression);
Expand Down

0 comments on commit 84efc2f

Please sign in to comment.