diff --git a/core/server/models/label.js b/core/server/models/label.js index 5cae314438..2d92cb717d 100644 --- a/core/server/models/label.js +++ b/core/server/models/label.js @@ -1,4 +1,5 @@ const ghostBookshelf = require('./base'); +const common = require('../lib/common'); let Label, Labels; @@ -108,7 +109,9 @@ Label = ghostBookshelf.Model.extend({ .fetch(options) .then(function destroyLabelsAndMember(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') diff --git a/core/server/models/tag.js b/core/server/models/tag.js index 53f79cd19e..f3245ad891 100644 --- a/core/server/models/tag.js +++ b/core/server/models/tag.js @@ -1,4 +1,5 @@ const ghostBookshelf = require('./base'); +const common = require('../lib/common'); let Tag, Tags; @@ -118,7 +119,9 @@ Tag = ghostBookshelf.Model.extend({ .fetch(options) .then(function destroyTagsAndPost(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')