Add more information to `__fbBatchedBridge is undefined` error

Summary:
**Motivation:**  This error can be a symptom of various other issues (see: an issue search for `__fbBatchedBridge is undefined`). I'm hoping to provide slightly more information about what might be going wrong and how to self-help.

**Test Plan:** Run some JS before the bridge has injected itself into the JS context. (sort of copping out here since the change is just to an error string literal.)
Closes https://github.com/facebook/react-native/pull/15184

Differential Revision: D5499445

Pulled By: javache

fbshipit-source-id: 8051869feb5fe5fc630516972775c134f6e41a04
This commit is contained in:
Ben Roth 2017-07-26 11:09:01 -07:00 committed by Facebook Github Bot
parent d188375e36
commit 26168d034d
1 changed files with 5 additions and 1 deletions

View File

@ -596,7 +596,11 @@ RCT_EXPORT_METHOD(setContextName:(nonnull NSString *)contextName)
}
} else {
if (!errorJSRef && JSC_JSValueGetType(ctx, batchedBridgeRef) == kJSTypeUndefined) {
error = RCTErrorWithMessage(@"Unable to execute JS call: __fbBatchedBridge is undefined");
error = RCTErrorWithMessage(@"Unable to execute JS call: __fbBatchedBridge is undefined. This can happen "
"if you try to execute JS and the bridge has not set up, for example if it encountered "
"an incomplete bundle or a fatal script execution error during startup. Verify that a "
"valid JS bundle is included with your app and that it loaded correctly, or try "
"reinstalling the app.");
}
}