3aa993cecb
* Don't log cancelling * redo exception handling for receive * remove null test case * clean up with Id/Json and more cancels * Change the exception stacks * fix serialization test * make a custom scrubber for internalized exceptions * clean up * fix namespaces again :( * adjust the scrubber * try to make tests more predictable * rework exceptions again * strip out compile files used * formatting * custom exception validation * fix init * Move serialization to own class * save serialize test * add deep clean * add cancellation test on save to cache * cancellation tests * format * do DI correctly * receive cancel works
33 lines
904 B
C#
33 lines
904 B
C#
using Speckle.Sdk.Common;
|
|
|
|
namespace Speckle.Sdk.Testing.Framework;
|
|
|
|
public class AggregationExceptionScrubber : WriteOnlyJsonConverter<AggregateException>
|
|
{
|
|
private static readonly ExceptionScrubber _innerScrubber = new();
|
|
|
|
public override void Write(VerifyJsonWriter writer, AggregateException exception)
|
|
{
|
|
writer.WriteStartObject();
|
|
|
|
writer.WriteMember(exception, exception.GetType().FullName, "Type");
|
|
if (exception.InnerExceptions.Count == 1)
|
|
{
|
|
writer.WritePropertyName("InnerException");
|
|
_innerScrubber.Write(writer, exception.InnerException.NotNull());
|
|
}
|
|
else
|
|
{
|
|
writer.WritePropertyName("InnerExceptions");
|
|
writer.WriteStartArray();
|
|
foreach (var innerException in exception.InnerExceptions)
|
|
{
|
|
_innerScrubber.Write(writer, innerException);
|
|
}
|
|
writer.WriteEndArray();
|
|
}
|
|
|
|
writer.WriteEndObject();
|
|
}
|
|
}
|