throw IllegalArgumentException instead of AssertionError when JS module is not found

Reviewed By: astreet

Differential Revision: D3190875

fb-gh-sync-id: ac34872d8d36247a8bb28bdfbf985ebcdadd4e33
fbshipit-source-id: ac34872d8d36247a8bb28bdfbf985ebcdadd4e33
This commit is contained in:
Felix Oghina 2016-04-18 10:00:00 -07:00 committed by Facebook Github Bot 7
parent 42cfba558f
commit a3ef44b4ba
1 changed files with 5 additions and 4 deletions

View File

@ -59,10 +59,11 @@ public class JavaScriptModuleRegistry {
return (T) module;
}
JavaScriptModuleRegistration registration =
Assertions.assertNotNull(
mModuleRegistrations.get(moduleInterface),
"JS module " + moduleInterface.getSimpleName() + " hasn't been registered!");
JavaScriptModuleRegistration registration = mModuleRegistrations.get(moduleInterface);
if (registration == null) {
throw new IllegalArgumentException(
"JS module " + moduleInterface.getSimpleName() + " hasn't been registered!");
}
JavaScriptModule interfaceProxy = (JavaScriptModule) Proxy.newProxyInstance(
moduleInterface.getClassLoader(),
new Class[]{moduleInterface},