mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Fixed error initialization syntax
refs https://linear.app/tryghost/issue/CORE-9/remove-eslint-warnings - Used an incorrect string parameter constructor for ghost errors previously. The errors should be initialized with an object containing a "message" property
This commit is contained in:
parent
4b70c7e0c0
commit
ee43133dd9
2 changed files with 9 additions and 3 deletions
|
@ -22,7 +22,9 @@ const lastPeriodStart = (startDate, interval) => {
|
||||||
return lastPeriodStartDate.toISO();
|
return lastPeriodStartDate.toISO();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IncorrectUsageError('Invalid interval specified. Only "month" value is accepted.');
|
throw new IncorrectUsageError({
|
||||||
|
message: 'Invalid interval specified. Only "month" value is accepted.'
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -20,7 +20,9 @@ class LimitService {
|
||||||
*/
|
*/
|
||||||
loadLimits({limits = {}, subscription, helpLink, db, errors}) {
|
loadLimits({limits = {}, subscription, helpLink, db, errors}) {
|
||||||
if (!errors) {
|
if (!errors) {
|
||||||
throw new IncorrectUsageError(`Config Missing: 'errors' is required.`);
|
throw new IncorrectUsageError({
|
||||||
|
message: `Config Missing: 'errors' is required.`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.errors = errors;
|
this.errors = errors;
|
||||||
|
@ -42,7 +44,9 @@ class LimitService {
|
||||||
this.limits[name] = new MaxLimit({name: name, config: limitConfig, helpLink, db, errors});
|
this.limits[name] = new MaxLimit({name: name, config: limitConfig, helpLink, db, errors});
|
||||||
} else if (_.has(limitConfig, 'maxPeriodic')) {
|
} else if (_.has(limitConfig, 'maxPeriodic')) {
|
||||||
if (subscription === undefined) {
|
if (subscription === undefined) {
|
||||||
throw new errors.IncorrectUsageError({message: 'Attempted to setup a periodic max limit without a subscription'});
|
throw new errors.IncorrectUsageError({
|
||||||
|
message: 'Attempted to setup a periodic max limit without a subscription'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxPeriodicLimitConfig = Object.assign({}, limitConfig, subscription);
|
const maxPeriodicLimitConfig = Object.assign({}, limitConfig, subscription);
|
||||||
|
|
Loading…
Reference in a new issue