0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Moved exception handling for members migrations

refs https://github.com/TryGhost/Toolbox/issues/358

- Error handling should be done as close to the place that knows how to handle them. It's a catch-all block which doesn't add any logic, so does not really make sense to have that extra code in general "init" method which ideally should be just a whole bunch of calls with no extras.
This commit is contained in:
Naz 2022-07-25 13:53:53 +01:00
parent 679634342a
commit 8c3473e5e0
2 changed files with 15 additions and 15 deletions

View file

@ -148,11 +148,7 @@ module.exports = {
}
})();
try {
await stripeService.migrations.execute();
} catch (err) {
logging.error(err);
}
await stripeService.migrations.execute();
},
contentGating: require('./content-gating'),

View file

@ -27,16 +27,20 @@ module.exports = class StripeMigrations {
return;
}
await this.populateProductsAndPrices();
await this.populateStripePricesFromStripePlansSetting();
await this.populateMembersMonthlyPriceIdSettings();
await this.populateMembersYearlyPriceIdSettings();
await this.populateDefaultProductMonthlyPriceId();
await this.populateDefaultProductYearlyPriceId();
await this.revertPortalPlansSetting();
await this.removeInvalidSubscriptions();
await this.setDefaultProductName();
await this.updateStripeProductNamesFromDefaultProduct();
try {
await this.populateProductsAndPrices();
await this.populateStripePricesFromStripePlansSetting();
await this.populateMembersMonthlyPriceIdSettings();
await this.populateMembersYearlyPriceIdSettings();
await this.populateDefaultProductMonthlyPriceId();
await this.populateDefaultProductYearlyPriceId();
await this.revertPortalPlansSetting();
await this.removeInvalidSubscriptions();
await this.setDefaultProductName();
await this.updateStripeProductNamesFromDefaultProduct();
} catch (err) {
logging.error(err);
}
}
async populateProductsAndPrices(options) {