From f7341269329d5c55e14b1f5149986c2d97cad020 Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Thu, 6 Feb 2025 12:48:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Example.Backend/Printer.cs | 1 + mROA.Codegen/obj/mROA.Codegen.csproj.nuget.g.props | 2 +- mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs | 2 +- mROA.Test/obj/mROA.Test.csproj.nuget.g.props | 2 +- mROA/Implementation/Backend/BasicExecutionModule.cs | 12 ++++++++++-- .../Backend/JsonSerialisationModule.cs | 4 ++++ mROA/Implementation/FinalCommandExecution.cs | 2 +- mROA/obj/mROA.csproj.nuget.g.props | 2 +- 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Example.Backend/Printer.cs b/Example.Backend/Printer.cs index 7ef462e..1ff2463 100644 --- a/Example.Backend/Printer.cs +++ b/Example.Backend/Printer.cs @@ -14,6 +14,7 @@ public class Printer : IPrinter public async Task> Print(string text, CancellationToken cancellationToken = default) { + throw new Exception("The method or operation is not implemented."); return new Page {Text = text}; } } \ No newline at end of file diff --git a/mROA.Codegen/obj/mROA.Codegen.csproj.nuget.g.props b/mROA.Codegen/obj/mROA.Codegen.csproj.nuget.g.props index 8f44f76..353ed1c 100644 --- a/mROA.Codegen/obj/mROA.Codegen.csproj.nuget.g.props +++ b/mROA.Codegen/obj/mROA.Codegen.csproj.nuget.g.props @@ -7,7 +7,7 @@ $(UserProfile)\.nuget\packages\ C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference - 6.12.1 + 6.12.0 diff --git a/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs b/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs index 459141c..e1a72d2 100644 --- a/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs +++ b/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+71e92f0301b2ba7aaaf7dca368a62bfba8554ca4")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0b455b8dd8fd256581b224169026e33dad4a222b")] [assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props index 92b7a7a..92a05d6 100644 --- a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props +++ b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props @@ -7,7 +7,7 @@ $(UserProfile)\.nuget\packages\ C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference - 6.12.1 + 6.12.0 diff --git a/mROA/Implementation/Backend/BasicExecutionModule.cs b/mROA/Implementation/Backend/BasicExecutionModule.cs index f88ec19..c40de4c 100644 --- a/mROA/Implementation/Backend/BasicExecutionModule.cs +++ b/mROA/Implementation/Backend/BasicExecutionModule.cs @@ -83,8 +83,16 @@ public class BasicExecutionModule : IExecuteModule result.ContinueWith(task => { - var finalResult = task.GetType().GetProperty("Result")?.GetValue(task); - PostFinalizedCallback(exec, finalResult); + try + { + var finalResult = task.GetType().GetProperty("Result")?.GetValue(task); + PostFinalizedCallback(exec, finalResult); + } + catch (Exception e) + { + _serialisationModule.PostResponse(new ExceptionCommandExecution {CallRequestId = exec.CallRequestId, CommandId = exec.CommandId, ClientId = exec.ClientId, Reason = e.InnerException.InnerException.ToString()}); + } + }, token); return exec; diff --git a/mROA/Implementation/Backend/JsonSerialisationModule.cs b/mROA/Implementation/Backend/JsonSerialisationModule.cs index 1190690..9087db1 100644 --- a/mROA/Implementation/Backend/JsonSerialisationModule.cs +++ b/mROA/Implementation/Backend/JsonSerialisationModule.cs @@ -38,7 +38,11 @@ public class JsonSerialisationModule : ISerialisationModule }else if (call is AsyncCommandExecution asyncCommand) { texted = JsonSerializer.Serialize(asyncCommand); + }else if (call is ExceptionCommandExecution exeptionCommandExecution) + { + texted = JsonSerializer.Serialize(exeptionCommandExecution); } + var binary = Encoding.UTF8.GetBytes(texted); _dataSource.SendTo(call.ClientId, binary); } diff --git a/mROA/Implementation/FinalCommandExecution.cs b/mROA/Implementation/FinalCommandExecution.cs index d6a96a3..2da715e 100644 --- a/mROA/Implementation/FinalCommandExecution.cs +++ b/mROA/Implementation/FinalCommandExecution.cs @@ -22,7 +22,7 @@ public class TypedFinalCommandExecution : FinalCommandExecution public Type Type { get; set; } } -public class ExeptionCommandExecution : ICommandExecution +public class ExceptionCommandExecution : ICommandExecution { public Guid CallRequestId { get; init; } public int ClientId { get; set; } diff --git a/mROA/obj/mROA.csproj.nuget.g.props b/mROA/obj/mROA.csproj.nuget.g.props index 8ec82c1..721d876 100644 --- a/mROA/obj/mROA.csproj.nuget.g.props +++ b/mROA/obj/mROA.csproj.nuget.g.props @@ -7,7 +7,7 @@ $(UserProfile)\.nuget\packages\ C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference - 6.12.1 + 6.12.0