Beispiel #1
0
        private async Task ExceptionHandlerAsync(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
        {
            var text = new StringBuilder();

            try
            {
                text.AppendLine($"Message handler encountered an exception {exceptionReceivedEventArgs.Exception}.");
                var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
                text.AppendLine("Exception context for troubleshooting:");
                text.AppendLine($"- Endpoint: {context.Endpoint}");
                text.AppendLine($"- Entity Path: {context.EntityPath}");
                text.AppendLine($"- Executing Action: {context.Action}");
            }
            finally
            {
                TraceAction?.Invoke(text.ToString());
            }
            await Task.CompletedTask;
        }
Beispiel #2
0
 public void Trace(string message)
 {
     TraceAction?.Invoke(message);
 }