diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.RemoveById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.RemoveById.cs index 5cae1f20..aa594bce 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.RemoveById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.RemoveById.cs @@ -24,7 +24,8 @@ private async Task ShouldThrowValidationExceptionOnRemoveByIdIfIdIsInvalidAsync( string invalidFileId = invalidId; var invalidFileException = - new InvalidAIFileException(); + new InvalidAIFileException( + message: "Invalid AI file error occurred, fix errors and try again."); invalidFileException.AddData( key: nameof(AIFile.Response.Id), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.Upload.cs index d3d570f8..bc399f80 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIFiles/AIFileServiceTests.Validations.Upload.cs @@ -19,7 +19,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfAIFileIsNull() { // given AIFile nullAIFile = null; - var nullAIFileException = new NullAIFileException(); + var nullAIFileException = new NullAIFileException( + message: "Ai file is null."); var expectedAIFileValidationException = new AIFileValidationException( @@ -52,7 +53,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfAIFileRequestIsNull() invalidAIFile.Request = null; var invalidAIFileException = - new InvalidAIFileException(); + new InvalidAIFileException( + message: "Invalid AI file error occurred, fix errors and try again."); invalidAIFileException.AddData( key: nameof(AIFile.Request), @@ -99,7 +101,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfAIFileRequestIsInvali }; var invalidAIFileException = - new InvalidAIFileException(); + new InvalidAIFileException( + message: "Invalid AI file error occurred, fix errors and try again."); invalidAIFileException.AddData( key: nameof(AIFileRequest.Name), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 9341dfe6..798c3dc1 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -45,7 +45,6 @@ public static TheoryData DependencyValidationExceptions() return new TheoryData { - new LocalFileValidationException( message: "Local file validation error occurred, fix error and try again.", someInnerException), @@ -54,16 +53,13 @@ public static TheoryData DependencyValidationExceptions() message: "Local file dependency validation error occurred, fix the errors and try again.", someInnerException), - new LocalFileValidationException( - message: "Local file validation error occurred, fix error and try again.", - someInnerException), - - new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + new AIFileValidationException( + message: "AI file validation error occurred, fix errors and try again.", someInnerException), - new AIFileValidationException(someInnerException), - new AIFileDependencyValidationException(someInnerException) + new AIFileDependencyValidationException( + message: "AI file dependency validation error occurred, contact support.", + someInnerException) }; } @@ -80,9 +76,14 @@ public static TheoryData DependencyExceptions() new LocalFileServiceException( message: "Local file service error occurred, contact support.", someInnerException), + + new AIFileDependencyException( + message: "AI file dependency error occurred, contact support.", + someInnerException), - new AIFileDependencyException(someInnerException), - new AIFileServiceException(someInnerException), + new AIFileServiceException( + message: "AI file service error occurred, contact support.", + someInnerException), }; } @@ -92,8 +93,13 @@ public static TheoryData AIFileServiceDependencyExceptions() return new TheoryData { - new AIFileDependencyException(someInnerException), - new AIFileServiceException(someInnerException), + new AIFileDependencyException( + message: "AI file dependency error occurred, contact support.", + someInnerException), + + new AIFileServiceException( + message: "AI file service error occurred, contact support.", + someInnerException), }; } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyException.cs index 88224d68..bf69218b 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class AIFileDependencyException : Xeption { - public AIFileDependencyException(Xeption innerException) - : base( - message: "AI file dependency error occurred, contact support.", - innerException: innerException) - { } - public AIFileDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyValidationException.cs index 52d11d2d..3912cf18 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class AIFileDependencyValidationException : Xeption { - public AIFileDependencyValidationException(Xeption innerException) - : base( - message: "AI file dependency validation error occurred, contact support.", - innerException: innerException) - { } - public AIFileDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileServiceException.cs index be7f0690..4a25d951 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class AIFileServiceException : Xeption { - public AIFileServiceException(Xeption innerException) - : base( - message: "AI file service error occurred, contact support.", - innerException: innerException) - { } - public AIFileServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileValidationException.cs index ebcd202d..4d2ae442 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/AIFileValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class AIFileValidationException : Xeption { - public AIFileValidationException(Xeption innerException) - : base( - message: "AI file validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIFileValidationException(string message, Xeption innerException) : base(message, innerException) { } } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/ExcessiveCallAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/ExcessiveCallAIFileException.cs index 2e39ed38..2d72ce68 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/ExcessiveCallAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/ExcessiveCallAIFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class ExcessiveCallAIFileException : Xeption { - public ExcessiveCallAIFileException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallAIFileException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedAIFileServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedAIFileServiceException.cs index 36757418..9f428778 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedAIFileServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedAIFileServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class FailedAIFileServiceException : Xeption { - public FailedAIFileServiceException(Exception innerException) - : base( - message: "Failed AI file service error occurred, contact support.", - innerException: innerException) - { } - public FailedAIFileServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedServerAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedServerAIFileException.cs index ab52c002..319722b5 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedServerAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/FailedServerAIFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class FailedServerAIFileException : Xeption { - public FailedServerAIFileException(Exception innerException) - : base( - message: "Failed AI file server error occurred, contact support.", - innerException: innerException) - { } - public FailedServerAIFileException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidAIFileException.cs index 70edd201..f6a2fbf9 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidAIFileException.cs @@ -9,15 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class InvalidAIFileException : Xeption { - public InvalidAIFileException() - : base( - message: "Invalid AI file error occurred, fix errors and try again.") - { } - - public InvalidAIFileException(Exception innerException) - : base( - message: "Invalid AI file error occurred, fix errors and try again.", - innerException: innerException) + public InvalidAIFileException(string message) + : base(message) { } public InvalidAIFileException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidConfigurationAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidConfigurationAIFileException.cs index 3d7d5251..90a25251 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidConfigurationAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/InvalidConfigurationAIFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class InvalidConfigurationAIFileException : Xeption { - public InvalidConfigurationAIFileException(Exception innerException) - : base( - message: "Invalid AI file configuration error occurred, contact support.", - innerException: innerException) - { } - public InvalidConfigurationAIFileException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NotFoundAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NotFoundAIFileException.cs index ce6f7943..4084b28f 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NotFoundAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NotFoundAIFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class NotFoundAIFileException : Xeption { - public NotFoundAIFileException(Exception innerException) - : base( - message: "Not found AI file error occurred, fix errors and try again.", - innerException: innerException) - { } - public NotFoundAIFileException(string message, Exception innerException) : base(message: message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NullAiFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NullAiFileException.cs index e6010317..8e71ad46 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NullAiFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/NullAiFileException.cs @@ -9,13 +9,12 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public partial class NullAIFileException : Xeption { - public NullAIFileException() - : base( - message: "Ai file is null.") + public NullAIFileException(String message) + : base(message) { } public NullAIFileException(string message, Exception innerException) : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/UnauthorizedAIFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/UnauthorizedAIFileException.cs index 5757d69e..78d6c96c 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/UnauthorizedAIFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIFiles/Exceptions/UnauthorizedAIFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions { public class UnauthorizedAIFileException : Xeption { - public UnauthorizedAIFileException(Exception innerException) - : base( - message: "Unauthorized AI file request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedAIFileException(string message, Exception innerException) : base(message, innerException) { } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs index 3c901b0c..b1c59a72 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs @@ -8,6 +8,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIFiles { @@ -24,67 +25,93 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (NullAIFileException nullAIFileException) { - throw new AIFileValidationException(nullAIFileException); + throw CreateAIFileValidationException( + nullAIFileException); } catch (InvalidAIFileException invalidFileException) { - throw new AIFileValidationException(invalidFileException); + throw CreateAIFileValidationException( + invalidFileException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationFileException = - new InvalidConfigurationAIFileException(httpResponseUrlNotFoundException); + new InvalidConfigurationAIFileException( + message: "Invalid AI file configuration error occurred, contact support.", + httpResponseUrlNotFoundException); - throw new AIFileDependencyException(invalidConfigurationFileException); + throw CreateAIFileDependencyException( + invalidConfigurationFileException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIFileException = - new UnauthorizedAIFileException(httpResponseUnauthorizedException); + new UnauthorizedAIFileException( + message: "Unauthorized AI file request, fix errors and try again.", + httpResponseUnauthorizedException); - throw new AIFileDependencyException(unauthorizedAIFileException); + throw CreateAIFileDependencyException( + unauthorizedAIFileException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIFileException = - new UnauthorizedAIFileException(httpResponseForbiddenException); + new UnauthorizedAIFileException( + message: "Unauthorized AI file request, fix errors and try again.", + httpResponseForbiddenException); - throw new AIFileDependencyException(unauthorizedAIFileException); + throw CreateAIFileDependencyException( + unauthorizedAIFileException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) { var notFoundAIFileException = - new NotFoundAIFileException(httpResponseNotFoundException); + new NotFoundAIFileException( + message: "Not found AI file error occurred, fix errors and try again.", + httpResponseNotFoundException); - throw new AIFileDependencyValidationException(notFoundAIFileException); + throw CreateAIFileDependencyValidationException( + notFoundAIFileException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidAIFileException = - new InvalidAIFileException(httpResponseBadRequestException); + new InvalidAIFileException( + message: "Invalid AI file error occurred, fix errors and try again.", + httpResponseBadRequestException); - throw new AIFileDependencyValidationException(invalidAIFileException); + throw CreateAIFileDependencyValidationException( + invalidAIFileException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIFileException = - new ExcessiveCallAIFileException(httpResponseTooManyRequestsException); + new ExcessiveCallAIFileException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); - throw new AIFileDependencyValidationException(excessiveCallAIFileException); + throw CreateAIFileDependencyValidationException( + excessiveCallAIFileException); } catch (HttpResponseException httpResponseException) { var failedServerAIFileException = - new FailedServerAIFileException(httpResponseException); + new FailedServerAIFileException( + message: "Failed AI file server error occurred, contact support.", + httpResponseException); - throw new AIFileDependencyException(failedServerAIFileException); + throw CreateAIFileDependencyException( + failedServerAIFileException); } catch (Exception exception) { var failedAIFileServiceException = - new FailedAIFileServiceException(exception); + new FailedAIFileServiceException( + message: "Failed AI file service error occurred, contact support.", + exception); - throw new AIFileServiceException(failedAIFileServiceException); + throw CreateAIFileServiceException( + failedAIFileServiceException); } } @@ -97,45 +124,92 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIFileException = - new InvalidConfigurationAIFileException(httpResponseUrlNotFoundException); + new InvalidConfigurationAIFileException( + message: "Invalid AI file configuration error occurred, contact support.", + httpResponseUrlNotFoundException); - throw new AIFileDependencyException(invalidConfigurationAIFileException); + throw CreateAIFileDependencyException( + invalidConfigurationAIFileException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIFileException = - new UnauthorizedAIFileException(httpResponseUnauthorizedException); + new UnauthorizedAIFileException( + message: "Unauthorized AI file request, fix errors and try again.", + httpResponseUnauthorizedException); - throw new AIFileDependencyException(unauthorizedAIFileException); + throw CreateAIFileDependencyException( + unauthorizedAIFileException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIFileException = - new UnauthorizedAIFileException(httpResponseForbiddenException); + new UnauthorizedAIFileException( + message: "Unauthorized AI file request, fix errors and try again.", + httpResponseForbiddenException); - throw new AIFileDependencyException(unauthorizedAIFileException); + throw CreateAIFileDependencyException( + unauthorizedAIFileException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIFileException = - new ExcessiveCallAIFileException(httpResponseTooManyRequestsException); + new ExcessiveCallAIFileException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); - throw new AIFileDependencyValidationException(excessiveCallAIFileException); + throw CreateAIFileDependencyValidationException( + excessiveCallAIFileException); } catch (HttpResponseException httpResponseException) { var failedServerAIFileException = - new FailedServerAIFileException(httpResponseException); + new FailedServerAIFileException( + message: "Failed AI file server error occurred, contact support.", + httpResponseException); - throw new AIFileDependencyException(failedServerAIFileException); + throw CreateAIFileDependencyException( + failedServerAIFileException); } catch (Exception exception) { var failedAIFileServiceException = - new FailedAIFileServiceException(exception); + new FailedAIFileServiceException( + message: "Failed AI file service error occurred, contact support.", + exception); - throw new AIFileServiceException(failedAIFileServiceException); + throw CreateAIFileServiceException( + failedAIFileServiceException); } } + + private static AIFileValidationException CreateAIFileValidationException(Xeption innerException) + { + throw new AIFileValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException); + } + + private static AIFileDependencyException CreateAIFileDependencyException(Xeption innerException) + { + return new AIFileDependencyException( + message: "AI file dependency error occurred, contact support.", + innerException); + } + + private static AIFileDependencyValidationException CreateAIFileDependencyValidationException( + Xeption innerException) + { + return new AIFileDependencyValidationException( + message: "AI file dependency validation error occurred, contact support.", + innerException); + } + + private static AIFileServiceException CreateAIFileServiceException(Xeption innerException) + { + return new AIFileServiceException( + message: "AI file service error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Validations.cs index 68f5fc7c..3f313f86 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Validations.cs @@ -27,7 +27,8 @@ private static void ValidateAIFileNotNull(AIFile aiFile) { if (aiFile is null) { - throw new NullAIFileException(); + throw new NullAIFileException( + message: "Ai file is null."); } } @@ -48,7 +49,9 @@ private static void ValidateFileId(string fileId) => private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidAIFileException = new InvalidAIFileException(); + var invalidAIFileException = + new InvalidAIFileException( + message: "Invalid AI file error occurred, fix errors and try again."); foreach ((dynamic rule, string parameter) in validations) { diff --git a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.cs b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.cs index 39b48041..84364999 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.cs @@ -2,13 +2,16 @@ // Copyright (c) The Standard Organization, a coalition of the Good-Hearted Engineers // ---------------------------------------------------------------------------------- +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; +using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAIFiles; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIFiles { @@ -115,5 +118,6 @@ private static AIFileStatus ConvertToAIFileStatus(string externalStatus) _ => AIFileStatus.Unknown }; } + } } \ No newline at end of file