From a6b9f09163c7a4648b3dc1ec81bf163755679eeb Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Mon, 24 Jun 2024 15:45:54 -0700 Subject: [PATCH] fix: use server metadata for item not found (#369) Consumes the server metadata change from element_not_found to item_not_found. --- .../momento/sdk/exceptions/CacheServiceExceptionMapper.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/momento-sdk/src/main/java/momento/sdk/exceptions/CacheServiceExceptionMapper.java b/momento-sdk/src/main/java/momento/sdk/exceptions/CacheServiceExceptionMapper.java index c3b91f43..4dd9e69c 100644 --- a/momento-sdk/src/main/java/momento/sdk/exceptions/CacheServiceExceptionMapper.java +++ b/momento-sdk/src/main/java/momento/sdk/exceptions/CacheServiceExceptionMapper.java @@ -52,7 +52,6 @@ public static SdkException convert(Throwable e, Metadata metadata) { String errorCause = trailers.get(Metadata.Key.of("err", Metadata.ASCII_STRING_MARSHALLER)); if (errorCause == null) { - // TODO remove once control service is updated to send "err" in metadata errorCause = grpcException.getMessage(); } @@ -82,9 +81,8 @@ public static SdkException convert(Throwable e, Metadata metadata) { return new LimitExceededException(grpcException, errorDetails); case NOT_FOUND: - if (errorCause.contains("element_not_found")) { + if (errorCause.contains("item_not_found")) { return new StoreItemNotFoundException(grpcException, errorDetails); - // TODO change once control service is updated to send "Store with name" in metadata } else if (errorCause.contains("Store with name")) { return new StoreNotFoundException(grpcException, errorDetails); } else {