Add exception handling for SerializeProcess with CancellationTokenSource (#211)

* Add exception handling for SerializeProcess with CancellationTokenSource

* formatting

* add exception test to make sure we handle a server exception

* add extra exception and handling to stop

* add comment and another test

* one last chance for user to cancel

* formatting
This commit is contained in:
Adam Hathcock
2025-01-23 17:06:08 +00:00
committed by GitHub
parent cc23c147be
commit f81fc97a91
13 changed files with 285 additions and 37 deletions
@@ -1,6 +1,7 @@
#pragma warning disable CA1506
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Speckle.Sdk;
using Speckle.Sdk.Credentials;
using Speckle.Sdk.Host;
@@ -45,7 +46,8 @@ var factory = new SerializeProcessFactory(
new ObjectSerializerFactory(new BasePropertyGatherer()),
new ObjectDeserializerFactory(),
serviceProvider.GetRequiredService<ISqLiteJsonCacheManagerFactory>(),
serviceProvider.GetRequiredService<IServerObjectManagerFactory>()
serviceProvider.GetRequiredService<IServerObjectManagerFactory>(),
new NullLoggerFactory()
);
var process = factory.CreateDeserializeProcess(new Uri(url), streamId, token, progress, new(skipCacheReceive));
var @base = await process.Deserialize(rootId, default).ConfigureAwait(false);