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

Commit d4ff75d

Browse files
committed
Adding logging to download and install
1 parent a65f97f commit d4ff75d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

CodePush.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ function sync(options = {}, syncStatusChangeCallback, downloadProgressCallback)
219219
};
220220

221221
return new Promise((resolve, reject) => {
222+
var rejectPromise = (error) => {
223+
syncStatusChangeCallback(CodePush.SyncStatus.UNKNOWN_ERROR);
224+
log(error.message);
225+
reject(error);
226+
};
227+
222228
CodePush.notifyApplicationReady()
223229
.then(() => {
224230
syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE);
@@ -235,7 +241,7 @@ function sync(options = {}, syncStatusChangeCallback, downloadProgressCallback)
235241
resolve(CodePush.SyncStatus.UPDATE_INSTALLED);
236242
});
237243
})
238-
.catch(reject)
244+
.catch(rejectPromise)
239245
.done();
240246
}
241247

@@ -292,11 +298,7 @@ function sync(options = {}, syncStatusChangeCallback, downloadProgressCallback)
292298
doDownloadAndInstall();
293299
}
294300
})
295-
.catch((error) => {
296-
syncStatusChangeCallback(CodePush.SyncStatus.UNKNOWN_ERROR);
297-
log(error.message);
298-
reject(error);
299-
})
301+
.catch(rejectPromise)
300302
.done();
301303
});
302304
};

0 commit comments

Comments
 (0)