Skip to content

Commit

Permalink
#14882 Remove catch predicate from intergrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave3of5 authored and ErisDS committed Aug 5, 2022
1 parent 6ce3e8e commit 2bdbe52
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ghost/core/core/server/api/endpoints/integrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ module.exports = {
},
query({data, options}) {
return models.Integration.findOne(data, Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
throw new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
});
.catch((e) => {
if (e instanceof models.Integration.NotFoundError) {
throw new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
});
}
});
}
},
Expand Down Expand Up @@ -136,10 +138,12 @@ module.exports = {
},
query({options}) {
return models.Integration.destroy(Object.assign(options, {require: true}))
.catch(models.Integration.NotFoundError, () => {
return Promise.reject(new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
}));
.catch((e) => {
if (e instanceof models.Integration.NotFoundError) {
return Promise.reject(new errors.NotFoundError({
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
}));
}
});
}
}
Expand Down

0 comments on commit 2bdbe52

Please sign in to comment.