From ce520b40ec2ef5c1a4e5116dcbdca51c054a2a1b Mon Sep 17 00:00:00 2001 From: SergeyMenshykh Date: Tue, 18 Jul 2023 16:10:21 +0100 Subject: [PATCH] GrpcOperationExceptionis replaced by SKException --- .../Skills/Skills.Grpc/GrpcOperationRunner.cs | 8 ++--- .../Model/GrpcOperationException.cs | 35 ------------------- 2 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 dotnet/src/Skills/Skills.Grpc/Model/GrpcOperationException.cs diff --git a/dotnet/src/Skills/Skills.Grpc/GrpcOperationRunner.cs b/dotnet/src/Skills/Skills.Grpc/GrpcOperationRunner.cs index ebb5a1a1ffe7..8f741a1b4914 100644 --- a/dotnet/src/Skills/Skills.Grpc/GrpcOperationRunner.cs +++ b/dotnet/src/Skills/Skills.Grpc/GrpcOperationRunner.cs @@ -111,7 +111,7 @@ private string GetAddress(GrpcOperation operation, IDictionary a if (string.IsNullOrEmpty(address)) { - throw new GrpcOperationException($"No address provided for the '{operation.Name}' gRPC operation."); + throw new SKException($"No address provided for the '{operation.Name}' gRPC operation."); } return address!; @@ -155,14 +155,14 @@ private object GenerateOperationRequest(GrpcOperation operation, Type type, IDic //Getting 'payload' argument to by used as gRPC request message if (!arguments.TryGetValue(GrpcOperation.PayloadArgumentName, out var payload)) { - throw new GrpcOperationException($"No '{GrpcOperation.PayloadArgumentName}' argument representing gRPC request message is found for the '{operation.Name}' gRPC operation."); + throw new SKException($"No '{GrpcOperation.PayloadArgumentName}' argument representing gRPC request message is found for the '{operation.Name}' gRPC operation."); } //Deserializing JSON payload to gRPC request message var instance = JsonSerializer.Deserialize(payload, type, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); if (instance == null) { - throw new GrpcOperationException($"Impossible to create gRPC request message for the '{operation.Name}' gRPC operation."); + throw new SKException($"Impossible to create gRPC request message for the '{operation.Name}' gRPC operation."); } return instance; @@ -226,7 +226,7 @@ private static TypeInfo BuildGrpcOperationDataContractType(GrpcOperationDataCont var type = typeBuilder.CreateTypeInfo(); if (type == null) { - throw new GrpcOperationException($"Impossible to create type for '{dataContractMetadata.Name}' data contract."); + throw new SKException($"Impossible to create type for '{dataContractMetadata.Name}' data contract."); } return type; diff --git a/dotnet/src/Skills/Skills.Grpc/Model/GrpcOperationException.cs b/dotnet/src/Skills/Skills.Grpc/Model/GrpcOperationException.cs deleted file mode 100644 index 2d7e43b419c2..000000000000 --- a/dotnet/src/Skills/Skills.Grpc/Model/GrpcOperationException.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -using System; - -namespace Microsoft.SemanticKernel.Skills.Grpc.Model; - -/// -/// Exception to be throw if a gRPC operation has failed. -/// -public class GrpcOperationException : Exception -{ - /// - /// Creates an instance of a class. - /// - /// The exception message. - internal GrpcOperationException(string message) : base(message) - { - } - - /// - /// Creates an instance of a class. - /// - /// The exception message. - /// The inner exception. - internal GrpcOperationException(string message, Exception innerException) : base(message, innerException) - { - } - - /// - /// Creates an instance of a class. - /// - internal GrpcOperationException() - { - } -}