0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Returned full error upon missing tag/label

no issue
This commit is contained in:
Daniel Lockyer 2020-04-15 10:15:48 +01:00
parent 9f27eeab02
commit 87bd26a4d6
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,5 @@
const ghostBookshelf = require('./base'); const ghostBookshelf = require('./base');
const common = require('../lib/common');
let Label, Labels; let Label, Labels;
@ -108,7 +109,9 @@ Label = ghostBookshelf.Model.extend({
.fetch(options) .fetch(options)
.then(function destroyLabelsAndMember(label) { .then(function destroyLabelsAndMember(label) {
if (!label) { if (!label) {
return Promise.reject(); return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.labels.labelNotFound')
}));
} }
return label.related('members') return label.related('members')

View file

@ -1,4 +1,5 @@
const ghostBookshelf = require('./base'); const ghostBookshelf = require('./base');
const common = require('../lib/common');
let Tag, Tags; let Tag, Tags;
@ -118,7 +119,9 @@ Tag = ghostBookshelf.Model.extend({
.fetch(options) .fetch(options)
.then(function destroyTagsAndPost(tag) { .then(function destroyTagsAndPost(tag) {
if (!tag) { if (!tag) {
return Promise.reject(); return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.tags.tagNotFound')
}));
} }
return tag.related('posts') return tag.related('posts')