0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-25 02:31:59 -05:00

Removed use of deprecated new Error() syntax

refs 2f1123d6ca
refs 6f1a3e1774

- As per refed commits, we are removing deprecated use of `new Error()` in the codebase
This commit is contained in:
Naz 2021-07-14 17:25:28 +04:00 committed by naz
parent a266c64130
commit 4c4af001e6

View file

@ -2,6 +2,12 @@ const {chunk} = require('lodash');
const ObjectID = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
unknownSubscriptionIntervalError: 'Unknown Subscription interval "{interval}" found.'
};
module.exports = createTransactionalMigration(
async function up(knex) {
@ -38,7 +44,11 @@ module.exports = createTransactionalMigration(
return amount * 30;
}
throw new Error(`Unknown Subscription interval "${interval}" found.`);
throw new errors.GhostError({
message: tpl(messages.unknownSubscriptionIntervalError , {
interval
})
});
}
const allEvents = allSubscriptions.reduce((allEventsAcc, subscription) => {