Ghost/ghost/offers/lib/domain/errors/index.js
Fabien O'Carroll 1f936357d9 Added concept of OfferStatus to domain model
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.
2021-10-12 15:27:27 +02:00

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
};