ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject ignite git commit: .NET: Improve async exception propagation
Date Mon, 29 May 2017 17:39:43 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 7adf588f0 -> 03b383c81


.NET: Improve async exception propagation


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03b383c8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03b383c8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03b383c8

Branch: refs/heads/master
Commit: 03b383c81bf2c7b7466164c849ac1a806d4afc3e
Parents: 7adf588
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Mon May 29 20:39:31 2017 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Mon May 29 20:39:31 2017 +0300

----------------------------------------------------------------------
 .../Compute/ComputeApiTest.cs                     | 18 ++++++++++++------
 .../Apache.Ignite.Core/Impl/Common/Future.cs      |  5 ++---
 2 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/03b383c8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 1d8ceb9..e4fd853 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -1285,9 +1285,9 @@ namespace Apache.Ignite.Core.Tests.Compute
         [Test]
         public void TestExceptions()
         {
-            Assert.Throws<BinaryObjectException>(() => _grid1.GetCompute().Broadcast(new
InvalidComputeAction()));
+            Assert.Throws<IgniteException>(() => _grid1.GetCompute().Broadcast(new
InvalidComputeAction()));
 
-            Assert.Throws<BinaryObjectException>(
+            Assert.Throws<IgniteException>(
                 () => _grid1.GetCompute().Execute<NetSimpleJobArgument, NetSimpleJobResult,
NetSimpleTaskResult>(
                     typeof (NetSimpleTask), new NetSimpleJobArgument(-1)));
 
@@ -1295,17 +1295,23 @@ namespace Apache.Ignite.Core.Tests.Compute
             var ex = Assert.Throws<IgniteException>(() =>
                 _grid1.GetCluster().ForLocal().GetCompute().Broadcast(new ExceptionalComputeAction()));
 
-            Assert.AreEqual("Compute job has failed on local node, examine InnerException
for details.", ex.Message);
+            Assert.AreEqual("Async operation has failed, examine InnerException for details.",
ex.Message);
             Assert.IsNotNull(ex.InnerException);
-            Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.Message);
+            Assert.AreEqual("Compute job has failed on local node, examine InnerException
for details.", 
+                ex.InnerException.Message);
+            Assert.IsNotNull(ex.InnerException.InnerException);
+            Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.InnerException.Message);
 
             // Remote.
             ex = Assert.Throws<IgniteException>(() =>
                 _grid1.GetCluster().ForRemotes().GetCompute().Broadcast(new ExceptionalComputeAction()));
 
-            Assert.AreEqual("Compute job has failed on remote node, examine InnerException
for details.", ex.Message);
+            Assert.AreEqual("Async operation has failed, examine InnerException for details.",
ex.Message);
             Assert.IsNotNull(ex.InnerException);
-            Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.Message);
+            Assert.AreEqual("Compute job has failed on remote node, examine InnerException
for details.",
+                ex.InnerException.Message);
+            Assert.IsNotNull(ex.InnerException.InnerException);
+            Assert.AreEqual(ExceptionalComputeAction.ErrorText, ex.InnerException.InnerException.Message);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/03b383c8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
index bfdf5cb..b69ad56 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
@@ -60,10 +60,9 @@ namespace Apache.Ignite.Core.Impl.Common
             }
             catch (AggregateException ex)
             {
-                if (ex.InnerException != null)
-                    throw ex.InnerException;
+                var innerEx = ex.InnerExceptions.Count > 1 ? ex : ex.InnerException;
 
-                throw;
+                throw new IgniteException("Async operation has failed, examine InnerException
for details.", innerEx);
             }
         }
 


Mime
View raw message