Permalink
Browse files

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 #15184

Differential Revision: D5499445

Pulled By: javache

fbshipit-source-id: 8051869feb5fe5fc630516972775c134f6e41a04
  • Loading branch information...
terribleben authored and facebook-github-bot committed Jul 26, 2017
1 parent d188375 commit 26168d034d88365cdfc5297c1866e2ba8e76a9d0
Showing with 5 additions and 1 deletion.
  1. +5 −1 React/Executors/RCTJSCExecutor.mm
@@ -596,7 +596,11 @@ - (void)_executeJSCall:(NSString *)method
}
} 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.");
}
}

0 comments on commit 26168d0

Please sign in to comment.