Skip to content

Commit

Permalink
Refactor: Wrap ApplicationProperties.get() and KafkaNotification
Browse files Browse the repository at this point in the history
…initialization in try-catch blocks

- Added exception handling for `ApplicationProperties.get()` and `KafkaNotification` initialization.
- Ensures `AtlasException` is caught and rethrown as `RuntimeException` for better runtime error propagation.
  • Loading branch information
abhijeet-atlan committed Nov 28, 2024
1 parent 98852bf commit b12bf1e
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,31 @@ public class EntityGraphMapper {

private static final Set<String> excludedTypes = new HashSet<>(Arrays.asList(TYPE_GLOSSARY, TYPE_CATEGORY, TYPE_TERM, TYPE_PRODUCT, TYPE_DOMAIN));

Configuration configuration = ApplicationProperties.get();
KafkaNotification kfknotif = new KafkaNotification(configuration);
Configuration configuration;

{
try {
configuration = ApplicationProperties.get();
} catch (AtlasException e) {
throw new RuntimeException(e);
}
}

KafkaNotification kfknotif;

{
try {
kfknotif = new KafkaNotification(configuration);
} catch (AtlasException e) {
throw new RuntimeException(e);
}
}

@Inject
public EntityGraphMapper(DeleteHandlerDelegate deleteDelegate, RestoreHandlerV1 restoreHandlerV1, AtlasTypeRegistry typeRegistry, AtlasGraph graph,
AtlasRelationshipStore relationshipStore, IAtlasEntityChangeNotifier entityChangeNotifier,
AtlasInstanceConverter instanceConverter, IFullTextMapper fullTextMapperV2,
TaskManagement taskManagement, TransactionInterceptHelper transactionInterceptHelper) throws AtlasException {
TaskManagement taskManagement, TransactionInterceptHelper transactionInterceptHelper) {
this.restoreHandlerV1 = restoreHandlerV1;
this.graphHelper = new GraphHelper(graph);
this.deleteDelegate = deleteDelegate;
Expand Down

0 comments on commit b12bf1e

Please sign in to comment.