diff --git a/ConnectorDynamo/ConnectorDynamo/ReceiveNode/Receive.cs b/ConnectorDynamo/ConnectorDynamo/ReceiveNode/Receive.cs index 857add95e5..55a3dc7275 100644 --- a/ConnectorDynamo/ConnectorDynamo/ReceiveNode/Receive.cs +++ b/ConnectorDynamo/ConnectorDynamo/ReceiveNode/Receive.cs @@ -324,12 +324,12 @@ void ErrorAction(string transportName, Exception e) { if (!_cancellationToken.IsCancellationRequested) { - //_cancellationToken.Cancel(); + _cancellationToken.Cancel(); var msg = e.ToFormattedString(); Message = msg.Contains("401") || msg.Contains("don't have access") ? "Not authorized" : "Error"; Warning(msg); _errors.Add(e); - //throw; + throw; } } finally diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs b/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs index 0551b638ef..71b34a02cc 100644 --- a/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs +++ b/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs @@ -19,6 +19,7 @@ private ISpeckleKit _kit get; set; } + public EventHandler OnError; public BatchConverter() @@ -331,16 +332,5 @@ public static bool IsDictionary(object @object) return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>); } } - - [IsVisibleInDynamoLibrary(false)] - public class OnErrorEventArgs : EventArgs - { - public Exception Error; - - public OnErrorEventArgs(Exception error) - { - Error = error; - } - } } diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/ConnectorDynamoFunctions.csproj b/ConnectorDynamo/ConnectorDynamoFunctions/ConnectorDynamoFunctions.csproj index d7d4367603..d639273724 100755 --- a/ConnectorDynamo/ConnectorDynamoFunctions/ConnectorDynamoFunctions.csproj +++ b/ConnectorDynamo/ConnectorDynamoFunctions/ConnectorDynamoFunctions.csproj @@ -1,4 +1,4 @@ - + @@ -72,6 +72,7 @@ + diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/Functions.cs b/ConnectorDynamo/ConnectorDynamoFunctions/Functions.cs index bab0dccd19..d4f87180b9 100644 --- a/ConnectorDynamo/ConnectorDynamoFunctions/Functions.cs +++ b/ConnectorDynamo/ConnectorDynamoFunctions/Functions.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading; using Autodesk.DesignScript.Runtime; +using Sentry; using Speckle.Core.Api; using Speckle.Core.Credentials; using Speckle.Core.Kits; @@ -159,11 +160,15 @@ public static Dictionary Receive(StreamWrapper stream, Cancellat cancellationToken, remoteTransport: transport, onProgressAction: onProgressAction, - onErrorAction: onErrorAction, + onErrorAction: ((s, exception) => throw exception), onTotalChildrenCountKnown: onTotalChildrenCountKnown, disposeTransports: true ).Result; + if (@base == null) + { + throw new SpeckleException("Receive operation returned nothing", false); + } try { client.CommitReceived(new CommitReceivedInput diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/OnErrorEventArgs.cs b/ConnectorDynamo/ConnectorDynamoFunctions/OnErrorEventArgs.cs new file mode 100644 index 0000000000..d0ba4df3fa --- /dev/null +++ b/ConnectorDynamo/ConnectorDynamoFunctions/OnErrorEventArgs.cs @@ -0,0 +1,16 @@ +using System; +using Autodesk.DesignScript.Runtime; + +namespace Speckle.ConnectorDynamo +{ + [IsVisibleInDynamoLibrary(false)] + public class OnErrorEventArgs + { + public Exception Error; + + public OnErrorEventArgs(Exception error) + { + Error = error; + } + } +}