Skip to content

Commit a31e5f6

Browse files
committed
Fix error handling of IAP
1 parent b1cf738 commit a31e5f6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/state/preferences/sagas.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@ function* saveAppPreference() {
1919
}
2020

2121
function* fetchPurchases() {
22-
const purchases = yield InAppPurchase.getPurchases();
23-
yield put({type: actionTypes.RECEIVE_PURCHASES, purchases});
22+
try {
23+
const purchases = yield InAppPurchase.getPurchases();
24+
yield put({type: actionTypes.RECEIVE_PURCHASES, purchases});
25+
} catch (e) {
26+
console.warn('Could not fetch purchases', e);
27+
}
2428
}
2529

2630
function* makeDonation() {
27-
const orderId = yield InAppPurchase.buy('donation');
28-
console.info(`InAppPurchase.buy => orderId: ${orderId}`);
31+
try {
32+
const orderId = yield InAppPurchase.buy('donation');
33+
console.info(`InAppPurchase.buy => orderId: ${orderId}`);
34+
} catch (e) {
35+
console.warn('Could not make a request for purchase', e);
36+
}
2937
yield fetchPurchases();
3038
}
3139

0 commit comments

Comments
 (0)