Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODE RUB: UnauthorizedAIModelException Class Update v2.10.1 #517

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions
{
public class UnauthorizedAIModelException : Xeption
{
public UnauthorizedAIModelException(Exception innerException)
: base(
message: "Unauthorized AI Model error occurred, fix errors and try again.",
innerException: innerException)
{ }

{
public UnauthorizedAIModelException(string message, Exception innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ private async ValueTask<AIModel> TryCatch(ReturningAIModelFunction returningAIMo
catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException)
{
var unauthorizedAIModelException =
new UnauthorizedAIModelException(httpResponseUnauthorizedException);
CreateUnauthorizedAIModelException(
httpResponseUnauthorizedException);

throw new AIModelDependencyException(unauthorizedAIModelException);
}
catch (HttpResponseForbiddenException httpResponseForbiddenException)
{
var unauthorizedAIModelException =
new UnauthorizedAIModelException(httpResponseForbiddenException);
CreateUnauthorizedAIModelException(
httpResponseForbiddenException);

throw new AIModelDependencyException(unauthorizedAIModelException);
}
Expand Down Expand Up @@ -101,14 +103,16 @@ private async ValueTask<IEnumerable<AIModel>> TryCatch(ReturningAIModelsFunction
catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException)
{
var unauthorizedAIModelException =
new UnauthorizedAIModelException(httpResponseUnauthorizedException);
CreateUnauthorizedAIModelException(
httpResponseUnauthorizedException);

throw new AIModelDependencyException(unauthorizedAIModelException);
}
catch (HttpResponseForbiddenException httpResponseForbiddenException)
{
var unauthorizedAIModelException =
new UnauthorizedAIModelException(httpResponseForbiddenException);
CreateUnauthorizedAIModelException(
httpResponseForbiddenException);

throw new AIModelDependencyException(unauthorizedAIModelException);
}
Expand All @@ -135,5 +139,13 @@ private async ValueTask<IEnumerable<AIModel>> TryCatch(ReturningAIModelsFunction
failedAIModelServiceException);
}
}

private static UnauthorizedAIModelException CreateUnauthorizedAIModelException(Exception innerException)
{
return new UnauthorizedAIModelException(
message: "Unauthorized AI Model error occurred, fix errors and try again.",
innerException);
}

}
}