Created
April 9, 2015 14:45
-
-
Save niemyjski/620fe74b8aadd7f9ce51 to your computer and use it in GitHub Desktop.
[TEST] Verify an AggregateException's inner exceptions are being reported.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Exceptionless.Plugins; | |
namespace Exceptionless.SampleConsole.Plugins { | |
[Priority(1)] | |
public class VerifyAggregateException : IEventPlugin { | |
public void Run(EventPluginContext context) { | |
if (!context.Event.IsError() || !context.ContextData.HasException()) | |
return; | |
var ag = context.ContextData.GetException() as AggregateException; | |
if (ag == null) | |
return; | |
// Set property will auto increment the name with an int. | |
foreach (var innerException in ag.InnerExceptions) | |
context.Event.SetProperty("AggregateInnerException", innerException.ToString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment