Returned Promise.reject instead of throwing error

no issue

- brings in line with other code changes
This commit is contained in:
Daniel Lockyer 2020-04-13 11:20:51 +01:00
parent 7409a4247c
commit 946f7b872f
6 changed files with 12 additions and 12 deletions

View File

@ -134,11 +134,11 @@ module.exports = {
query({options}) {
return models.Integration.destroy(Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.resource.resourceNotFound', {
resource: 'Integration'
})
});
}));
});
}
}

View File

@ -198,9 +198,9 @@ module.exports = {
return models.Post.destroy(frame.options)
.then(() => null)
.catch(models.Post.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.pages.pageNotFound')
});
}));
});
}
}

View File

@ -233,9 +233,9 @@ module.exports = {
return models.Post.destroy(frame.options)
.then(() => null)
.catch(models.Post.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.posts.postNotFound')
});
}));
});
}
}

View File

@ -134,11 +134,11 @@ module.exports = {
query({options}) {
return models.Integration.destroy(Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.resource.resourceNotFound', {
resource: 'Integration'
})
});
}));
});
}
}

View File

@ -198,9 +198,9 @@ module.exports = {
return models.Post.destroy(frame.options)
.then(() => null)
.catch(models.Post.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.pages.pageNotFound')
});
}));
});
}
}

View File

@ -193,9 +193,9 @@ module.exports = {
return models.Post.destroy(frame.options)
.then(() => null)
.catch(models.Post.NotFoundError, () => {
throw new common.errors.NotFoundError({
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.posts.postNotFound')
});
}));
});
}
}