Files
speckle-sharp-sdk/tests/Speckle.Sdk.Testing/Framework/ExceptionScrubber.cs
T
Adam Hathcock c3d716f6fd fix: an exception in the underlying code results in UnobservedTaskExceptions and not ending of the send process. (#237)
* Cancel all channels when first exception happens then throw that exception

* Use single exception to end things.

* fix verifications

* fmt

* Fix tests as stacktrace was removed

* Handle one exception and cancel on receive

* moved ThrowIfFailed and made throw speckle exceptions

* Fixed tests

* fmt
2025-02-27 14:04:02 +00:00

19 lines
520 B
C#

using Argon;
namespace Speckle.Sdk.Testing.Framework;
public class ExceptionScrubber : WriteOnlyJsonConverter<Exception>
{
public override void Write(VerifyJsonWriter writer, Exception value)
{
var ex = new JObject
{
["Type"] = value.GetType().FullName,
["Message"] = value.Message,
["Source"] = value.Source?.Trim(),
};
//intentionally removed stacktrace to avoid errors on different machines and line numbers
writer.WriteRawValue(ex.ToString(Formatting.Indented));
}
}