Skip to content

Commit

Permalink
fix: use server metadata for item not found (#369)
Browse files Browse the repository at this point in the history
Consumes the server metadata change from element_not_found to item_not_found.
  • Loading branch information
malandis authored Jun 24, 2024
1 parent d5896ff commit a6b9f09
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a6b9f09

Please sign in to comment.