1f936357d9
refs https://github.com/TryGhost/Team/issues/1131 This allows us to model the behaviour of archived & active offers, as well as allowing us to set their status on the model.
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const {GhostError} = require('@tryghost/errors');
|
|
|
|
class InvalidPropError extends GhostError {
|
|
/** @param {any} options */
|
|
constructor(options) {
|
|
super({
|
|
statusCode: 400,
|
|
...options
|
|
});
|
|
this.errorType = this.constructor.name;
|
|
}
|
|
}
|
|
|
|
class InvalidOfferName extends InvalidPropError {}
|
|
class InvalidOfferTitle extends InvalidPropError {}
|
|
class InvalidOfferDescription extends InvalidPropError {}
|
|
class InvalidOfferCode extends InvalidPropError {}
|
|
class InvalidOfferType extends InvalidPropError {}
|
|
class InvalidOfferAmount extends InvalidPropError {}
|
|
class InvalidOfferCurrency extends InvalidPropError {}
|
|
class InvalidOfferTierName extends InvalidPropError {}
|
|
class InvalidOfferCadence extends InvalidPropError {}
|
|
class InvalidOfferDuration extends InvalidPropError {}
|
|
class InvalidOfferCoupon extends InvalidPropError {}
|
|
class InvalidOfferStatus extends InvalidPropError {}
|
|
|
|
module.exports = {
|
|
InvalidOfferName,
|
|
InvalidOfferTitle,
|
|
InvalidOfferDescription,
|
|
InvalidOfferCode,
|
|
InvalidOfferType,
|
|
InvalidOfferAmount,
|
|
InvalidOfferCurrency,
|
|
InvalidOfferCadence,
|
|
InvalidOfferDuration,
|
|
InvalidOfferTierName,
|
|
InvalidOfferCoupon,
|
|
InvalidOfferStatus
|
|
};
|