eric-maynard commented on code in PR #1758:
URL: https://github.com/apache/polaris/pull/1758#discussion_r2116272566


##########
service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java:
##########
@@ -51,19 +51,25 @@ public DefaultConfigurationStore(
 
   @Override
   public <T> @Nullable T getConfiguration(@Nonnull PolarisCallContext ctx, 
String configName) {
-    if (!realmContextInstance.isUnsatisfied()) {
-      RealmContext realmContext = realmContextInstance.get();
-      String realm = realmContext.getRealmIdentifier();
-      LOGGER.debug("Get configuration value for {} with realm {}", configName, 
realm);
-      @SuppressWarnings("unchecked")
-      T confgValue =
-          (T)
-              Optional.ofNullable(realmOverrides.getOrDefault(realm, 
Map.of()).get(configName))
-                  .orElseGet(() -> getDefaultConfiguration(configName));
-      return confgValue;
-    } else {
-      LOGGER.debug(
-          "No RealmContext is injected when lookup value for configuration {} 
", configName);
+    try {
+      if (realmContextInstance.isResolvable()) {
+        RealmContext realmContext = realmContextInstance.get();
+        String realm = realmContext.getRealmIdentifier();
+        LOGGER.debug("Get configuration value for {} with realm {}", 
configName, realm);
+        @SuppressWarnings("unchecked")
+        T confgValue =
+            (T)
+                Optional.ofNullable(realmOverrides.getOrDefault(realm, 
Map.of()).get(configName))
+                    .orElseGet(() -> getDefaultConfiguration(configName));
+        return confgValue;
+      } else {
+        LOGGER.debug(
+            "No RealmContext is injected when lookup value for configuration 
{} ", configName);
+        return getDefaultConfiguration(configName);
+      }
+    } catch (Exception e) {
+      LOGGER.debug("Exception encountered when lookup value for configuration 
{}", configName, e);
+      // fall back to the default behavior
       return getDefaultConfiguration(configName);

Review Comment:
   IIUC the config store can be user provided, so we can't anticipate many 
specifics about the exception type.
   
   Perhaps we should make this `RuntimeException` though, so:
   1. We don't swallow things like interrupts
   2. The user-provided config store has the ability to _not_ get its exception 
swallowed if it so chooses



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to