From 4c4af001e6844012e96c9047d5aec430b016fe76 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 14 Jul 2021 17:25:28 +0400 Subject: [PATCH] Removed use of deprecated new Error() syntax refs https://github.com/TryGhost/Ghost/commit/2f1123d6ca7894fc21499739f46f0ae5c9eda73a refs https://github.com/TryGhost/Ghost/commit/6f1a3e17749e878a379830f12672b266c15bc835 - As per refed commits, we are removing deprecated use of `new Error()` in the codebase --- ...opulate-members-paid-subscription-events-table.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js b/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js index f81d45adc4..fef9ae0a16 100644 --- a/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js +++ b/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js @@ -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) => {