Skip to content

Commit a682e5e

Browse files
authored
chore: updating experimental plugin registration order (#304)
All hooks should be added before any register is invoked for a given instance.
1 parent f5c7239 commit a682e5e

File tree

1 file changed

+7
-1
lines changed
  • launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android

1 file changed

+7
-1
lines changed

launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android/LDClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,16 @@ public static Future<LDClient> init(@NonNull Application application,
218218
for (Hook hook : pluginHooks) {
219219
instance.hookRunner.addHook(hook);
220220
}
221+
} catch (Exception e) {
222+
logger.error("Exception thrown getting hooks for plugin " + plugin.getMetadata().getName() + ". Unable to get hooks, plugin will not be registered.");
223+
}
224+
}
221225

226+
for (Plugin plugin : instance.plugins) {
227+
try {
222228
plugin.register(instance, metadata);
223229
} catch (Exception e) {
224-
logger.error("Exception thrown getting hooks for plugin " + plugin.getMetadata().getName() + ". Unable to get hooks, plugin will not be registered.");
230+
logger.error("Exception thrown registering plugin " + plugin.getMetadata().getName() + ".");
225231
}
226232
}
227233
}

0 commit comments

Comments
 (0)