Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit f92acc6

Browse files
committed
update error handling
1 parent 36cc292 commit f92acc6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CodePush.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ function codePushify(options = {}) {
410410
if (!React) {
411411
try { React = ReactNative.React; } catch (e) { }
412412
if (!React) {
413+
throw new Error("Unable to find the 'React' module.");
414+
}
415+
if (!React.Component) {
413416
throw new Error(
414417
`Unable to find the 'Component' class, please either:
415418
1. Upgrade to a newer version of React Native that supports it, or
@@ -423,8 +426,7 @@ function codePushify(options = {}) {
423426
let rootComponentInstance = this.refs.rootComponent;
424427
let syncStatusCallback = rootComponentInstance && rootComponentInstance.codePushStatusDidChange;
425428
let downloadProgressCallback = rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress;
426-
427-
CodePush.sync(options, syncStatusCallback, downloadProgressCallback);
429+
CodePush.sync(options, syncStatusCallback, downloadProgressCallback)
428430
if (options.syncMode === CodePush.SyncMode.ON_APP_RESUME) {
429431
ReactNative.AppState.addEventListener("change", (newState) => {
430432
newState === "active" && CodePush.sync(options, syncStatusCallback, downloadProgressCallback);

0 commit comments

Comments
 (0)