Skip to content

Commit 1b0e8d9

Browse files
petrov-mgtkledkov
authored andcommitted
IGNITE-17499 Fixed propagation of service call exception stacktrace to the client side (#10186)
(cherry picked from commit 076ef80)
1 parent fe05c2d commit 1b0e8d9

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/service/ClientServiceInvokeRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public ClientServiceInvokeRequest(BinaryReaderExImpl reader, ClientProtocolConte
195195
catch (PlatformNativeException e) {
196196
ctx.kernalContext().log(getClass()).error("Failed to invoke platform service", e);
197197

198-
throw new IgniteException("Failed to invoke platform service, see server logs for details");
198+
throw new IgniteException("Failed to invoke platform service, see server logs for details", e);
199199
}
200200
catch (Throwable e) {
201201
throw new IgniteException(e);

modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Apache.Ignite.Core.Tests.Client
3636
using Apache.Ignite.Core.Tests.Client.Cache;
3737
using Apache.Ignite.Core.Tests.Client.Compute;
3838
using Apache.Ignite.Core.Tests.Compute;
39+
using Apache.Ignite.Core.Tests.Services;
3940
using NUnit.Framework;
4041

4142
/// <summary>
@@ -954,6 +955,37 @@ public void TestSslConnectionWithoutClientAuth()
954955
}
955956
}
956957

958+
/// <summary>
959+
/// Tests that the stack trace of an exception that occurred during a service call is propagated to the thin
960+
/// client side.
961+
/// </summary>
962+
[Test]
963+
public void TestSendServerServiceExceptionStackTraceToClient()
964+
{
965+
var ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
966+
{
967+
ClientConnectorConfiguration = new ClientConnectorConfiguration
968+
{
969+
ThinClientConfiguration = new ThinClientConfiguration
970+
{
971+
SendServerExceptionStackTraceToClient = true,
972+
}
973+
}
974+
});
975+
976+
const string svcName = "PlatformTestService";
977+
978+
ignite.GetServices().DeployClusterSingleton(svcName, new PlatformTestService());
979+
980+
using var client = StartClient();
981+
982+
var ex = Assert.Catch<Exception>(() =>
983+
client.GetServices().GetServiceProxy<IJavaService>(svcName).testException("")).GetBaseException();
984+
985+
StringAssert.Contains("ClassName=System.NotImplementedException", ex.Message);
986+
StringAssert.Contains("Message=The method or operation is not implemented.", ex.Message);
987+
}
988+
957989
/// <summary>
958990
/// Tests that server exception stack trace is included in error details when enabled.
959991
/// </summary>

0 commit comments

Comments
 (0)