From 6210d13b4c6635826e8ba7227971bfbb2100755c Mon Sep 17 00:00:00 2001 From: maheshrajamani <99678631+maheshrajamani@users.noreply.github.com> Date: Fri, 24 May 2024 12:18:32 -0400 Subject: [PATCH] Adding error codes that will be returned from EGW service --- .../java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java | 4 +++- .../service/resolver/model/impl/ValidateCredentials.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java b/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java index 1bbffca34a..e17a30cbf9 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java @@ -183,7 +183,9 @@ public enum ErrorCode { SERVER_FAILURE("Driver failed"), SERVER_UNHANDLED_ERROR("Server failed"), INVALID_PARAMETER_VALIDATION_TYPE("Invalid Parameter Validation Type"), - SERVER_EMBEDDING_GATEWAY_NOT_AVAILABLE("Embedding Gateway is not available"); + SERVER_EMBEDDING_GATEWAY_NOT_AVAILABLE("Embedding Gateway is not available"), + EMBEDDING_GATEWAY_ERROR_RATE_LIMIT("Embedding Gateway error rate limit reached for the tenant"), + EMBEDDING_GATEWAY_PROCESSING_ERROR("Embedding Gateway failed to process request"); private final String message; diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/ValidateCredentials.java b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/ValidateCredentials.java index b2a05a07ce..0424778544 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/ValidateCredentials.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/ValidateCredentials.java @@ -46,6 +46,6 @@ public boolean validate(String provider, String value) { } void onStop(@Observes ShutdownEvent ev) { - channel.shutdown(); + if (channel != null) channel.shutdown(); } }