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:
parent
a016834427
commit
3c76172e81
1 changed files with 12 additions and 8 deletions
|
@ -53,10 +53,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
query({data, options}) {
|
query({data, options}) {
|
||||||
return models.Integration.findOne(data, Object.assign(options, {require: true}))
|
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({
|
throw new errors.NotFoundError({
|
||||||
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -136,10 +138,12 @@ module.exports = {
|
||||||
},
|
},
|
||||||
query({options}) {
|
query({options}) {
|
||||||
return models.Integration.destroy(Object.assign(options, {require: true}))
|
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({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue