начало реализации исключений
This commit is contained in:
@@ -14,6 +14,7 @@ public class Printer : IPrinter
|
||||
|
||||
public async Task<TransmittedSharedObject<IPage>> Print(string text, CancellationToken cancellationToken = default)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
return new Page {Text = text};
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.1</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.1</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TypedFinalCommandExecution : FinalCommandExecution<object>
|
||||
public Type Type { get; set; }
|
||||
}
|
||||
|
||||
public class ExeptionCommandExecution : ICommandExecution
|
||||
public class ExceptionCommandExecution : ICommandExecution
|
||||
{
|
||||
public Guid CallRequestId { get; init; }
|
||||
public int ClientId { get; set; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.1</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
|
||||
|
||||
Reference in New Issue
Block a user