From 18aca66929ae4979a8e0542377aea51ef7160f82 Mon Sep 17 00:00:00 2001 From: Gabe Lyons Date: Wed, 29 Jun 2022 08:21:05 -0700 Subject: [PATCH] more specific exceptions --- .../kafka/hook/siblings/SiblingAssociationHook.java | 8 ++++---- .../java/com/linkedin/entity/client/EntityClient.java | 2 +- .../java/com/linkedin/entity/client/JavaEntityClient.java | 2 +- .../com/linkedin/entity/client/RestliEntityClient.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/metadata-jobs/mae-consumer/src/main/java/com/linkedin/metadata/kafka/hook/siblings/SiblingAssociationHook.java b/metadata-jobs/mae-consumer/src/main/java/com/linkedin/metadata/kafka/hook/siblings/SiblingAssociationHook.java index d99fd9d9abc6af..d8808c5b5abeb8 100644 --- a/metadata-jobs/mae-consumer/src/main/java/com/linkedin/metadata/kafka/hook/siblings/SiblingAssociationHook.java +++ b/metadata-jobs/mae-consumer/src/main/java/com/linkedin/metadata/kafka/hook/siblings/SiblingAssociationHook.java @@ -250,7 +250,7 @@ private void setSiblingsAndSoftDeleteSibling(Urn dbtUrn, Urn sourceUrn) { newSiblingsUrnArray.stream().filter(urn -> { try { return _entityClient.exists(urn, _systemAuthentication); - } catch (Exception e) { + } catch (RemoteInvocationException e) { log.error("Error while checking existence of {}: {}", urn.toString(), e.toString()); throw new RuntimeException("Error checking existence. Skipping processing.", e); } @@ -392,7 +392,7 @@ private SubTypes getSubtypesFromEntityClient( } else { return null; } - } catch (Exception e) { + } catch (RemoteInvocationException | URISyntaxException e) { throw new RuntimeException("Failed to retrieve Subtypes", e); } } @@ -413,7 +413,7 @@ private UpstreamLineage getUpstreamLineageFromEntityClient( } else { return null; } - } catch (Exception e) { + } catch (RemoteInvocationException | URISyntaxException e) { throw new RuntimeException("Failed to retrieve UpstreamLineage", e); } } @@ -434,7 +434,7 @@ private Siblings getSiblingsFromEntityClient( } else { return null; } - } catch (Exception e) { + } catch (RemoteInvocationException | URISyntaxException e) { throw new RuntimeException("Failed to retrieve UpstreamLineage", e); } } diff --git a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/EntityClient.java b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/EntityClient.java index e4268c23a0f44a..1ebe7fe3674b14 100644 --- a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/EntityClient.java +++ b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/EntityClient.java @@ -297,5 +297,5 @@ public DataMap getRawAspect(@Nonnull String urn, @Nonnull String aspect, @Nonnul public void producePlatformEvent(@Nonnull String name, @Nullable String key, @Nonnull PlatformEvent event, @Nonnull Authentication authentication) throws Exception; - Boolean exists(Urn urn, @Nonnull Authentication authentication) throws Exception; + Boolean exists(Urn urn, @Nonnull Authentication authentication) throws RemoteInvocationException; } diff --git a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/JavaEntityClient.java b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/JavaEntityClient.java index 2812349032fa34..d2ca0906569c8a 100644 --- a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/JavaEntityClient.java +++ b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/JavaEntityClient.java @@ -465,7 +465,7 @@ public void producePlatformEvent( } @Override - public Boolean exists(Urn urn, @Nonnull Authentication authentication) throws Exception { + public Boolean exists(Urn urn, @Nonnull Authentication authentication) throws RemoteInvocationException { return _entityService.exists(urn); } } diff --git a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/RestliEntityClient.java b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/RestliEntityClient.java index c99c4c2d27beb2..d580d4f2392da1 100644 --- a/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/RestliEntityClient.java +++ b/metadata-service/restli-client/src/main/java/com/linkedin/entity/client/RestliEntityClient.java @@ -665,7 +665,7 @@ public void producePlatformEvent(@Nonnull String name, @Nullable String key, @No } @Override - public Boolean exists(Urn urn, @Nonnull Authentication authentication) throws Exception { + public Boolean exists(Urn urn, @Nonnull Authentication authentication) throws RemoteInvocationException { final EntitiesDoExistsRequestBuilder requestBuilder = ENTITIES_REQUEST_BUILDERS.actionExists().urnParam(urn.toString()); return sendClientRequest(requestBuilder, authentication).getEntity();