0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

removed catch predicate from integrations (#14969)

refs https://github.com/TryGhost/Ghost/issues/14882

- catch predicates make removing Bluebird from other parts of the code risky.
This commit is contained in:
David Kolosowski 2022-08-05 14:21:02 +01:00 committed by GitHub
parent a016834427
commit 3c76172e81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,10 +53,12 @@ module.exports = {
},
query({data, options}) {
return models.Integration.findOne(data, Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
.catch((e) => {
if (e instanceof models.Integration.NotFoundError) {
throw new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
});
}
});
}
},
@ -136,10 +138,12 @@ module.exports = {
},
query({options}) {
return models.Integration.destroy(Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
.catch((e) => {
if (e instanceof models.Integration.NotFoundError) {
return Promise.reject(new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
}));
}
});
}
}