mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
TurboModules: Improve Error Message
Summary: More verbose but descriptive error message when `TurboModule.getEnforcing` fails to find a native module. Reviewed By: cpojer, gaearon Differential Revision: D15619293 fbshipit-source-id: 0e8af4986d6ce9002966bb062766218ce9f89a13
This commit is contained in:
committed by
Facebook Github Bot
parent
d45818fe47
commit
8a014cdfb3
@@ -33,6 +33,10 @@ export function get<T: TurboModule>(name: string): ?T {
|
||||
|
||||
export function getEnforcing<T: TurboModule>(name: string): T {
|
||||
const module = get(name);
|
||||
invariant(module != null, `${name} is not available in this app.`);
|
||||
invariant(
|
||||
module != null,
|
||||
`TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` +
|
||||
'Verify that a module by this name is registered in the native binary.',
|
||||
);
|
||||
return module;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user