mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Improved error messages for Offers API
no-issue
This commit is contained in:
parent
af1a019f0e
commit
668a9d47ba
@ -1,6 +1,6 @@
|
||||
const {GhostError} = require('@tryghost/errors');
|
||||
const {ValidationError} = require('@tryghost/errors');
|
||||
|
||||
class InvalidPropError extends GhostError {
|
||||
class InvalidPropError extends ValidationError {
|
||||
/** @param {any} options */
|
||||
constructor(options) {
|
||||
super({
|
||||
|
@ -192,7 +192,7 @@ class Offer {
|
||||
}
|
||||
if (!await uniqueChecker.isUniqueCode(code)) {
|
||||
throw new errors.InvalidOfferCode({
|
||||
message: 'Offer `code` must be unique.'
|
||||
message: `Offer 'code' must be unique. Please change and try again.`
|
||||
});
|
||||
}
|
||||
this.changed.code = this.props.code;
|
||||
@ -210,7 +210,7 @@ class Offer {
|
||||
}
|
||||
if (!await uniqueChecker.isUniqueName(name)) {
|
||||
throw new errors.InvalidOfferName({
|
||||
message: 'Offer `name` must be unique.'
|
||||
message: `Offer 'name' must be unique. Please change and try again.`
|
||||
});
|
||||
}
|
||||
this.props.name = name;
|
||||
@ -288,7 +288,7 @@ class Offer {
|
||||
if (isNew) {
|
||||
if (!await uniqueChecker.isUniqueName(name)) {
|
||||
throw new errors.InvalidOfferName({
|
||||
message: 'Offer `name` must be unique.'
|
||||
message: `Offer 'name' must be unique. Please change and try again.`
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -296,7 +296,7 @@ class Offer {
|
||||
if (isNew) {
|
||||
if (!await uniqueChecker.isUniqueCode(code)) {
|
||||
throw new errors.InvalidOfferCode({
|
||||
message: 'Offer `code` must be unique.'
|
||||
message: `Offer 'code' must be unique. Please change and try again.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user