Skip to content

Commit

Permalink
Merge pull request #558 from Lezune/user/lezune/coderub-aifiles-upgra…
Browse files Browse the repository at this point in the history
…de-v2101

CODE RUB: AIFiles Exception Classes Update v2.10.1
  • Loading branch information
glhays committed Jun 13, 2024
2 parents 9af6fc0 + 7b4b12a commit 13ff551
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static TheoryData DependencyValidationExceptions()

return new TheoryData<Xeption>
{

new LocalFileValidationException(
message: "Local file validation error occurred, fix error and try again.",
someInnerException),
Expand All @@ -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)
};
}

Expand All @@ -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),
};
}

Expand All @@ -92,8 +93,13 @@ public static TheoryData AIFileServiceDependencyExceptions()

return new TheoryData<Xeption>
{
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),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
}
Expand Down
Loading

0 comments on commit 13ff551

Please sign in to comment.