diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs index 500c83b4..83229366 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class UnauthorizedImageGenerationException : Xeption { - public UnauthorizedImageGenerationException(Exception innerException) - : base( - message: "Unauthorized image generation request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index aa7326ac..89ce7770 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -44,7 +44,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException(httpResponseUnauthorizedException); + new UnauthorizedImageGenerationException( + message: "Unauthorized image generation request, fix errors and try again.", + httpResponseUnauthorizedException); throw CreateImageGenerationDependencyException( unauthorizedImageGenerationException); @@ -52,7 +54,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException(httpResponseForbiddenException); + new UnauthorizedImageGenerationException( + message: "Unauthorized image generation request, fix errors and try again.", + httpResponseForbiddenException); throw CreateImageGenerationDependencyException( unauthorizedImageGenerationException); @@ -104,12 +108,17 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti message: "Failed image generation service error occurred, contact support.", exception); - throw new ImageGenerationServiceException( - message: "Image generation service error occurred, contact support.", - failedImageGenerationServiceException); + throw CreateImageGenerationServiceException(failedImageGenerationServiceException); } } + private static ImageGenerationValidationException CreateImageGenerationValidationException(Xeption innerException) + { + return new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException); + } + private static ImageGenerationDependencyException CreateImageGenerationDependencyException(Xeption innerException) { return new ImageGenerationDependencyException( @@ -124,10 +133,10 @@ private static ImageGenerationDependencyValidationException CreateImageGeneratio innerException); } - private static ImageGenerationValidationException CreateImageGenerationValidationException(Xeption innerException) + private static ImageGenerationServiceException CreateImageGenerationServiceException(Exception innerException) { - return new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", + return new ImageGenerationServiceException( + message: "Image generation service error occurred, contact support.", innerException); } }