0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Adding sentry logging to all ping errors

issue TryGhost/Team#362
This commit is contained in:
Thibaut Patel 2021-02-19 14:00:50 +01:00
parent b28b4e1cb0
commit 9e93ed7ef0

View file

@ -83,23 +83,24 @@ function ping(post) {
}
})
.catch(function (err) {
let error;
if (err.statusCode === 429) {
const error = new errors.TooManyRequestsError({
error = new errors.TooManyRequestsError({
err,
message: err.message,
context: i18n.t('errors.services.ping.requestFailed.error', {service: 'xmlrpc'}),
help: i18n.t('errors.services.ping.requestFailed.help', {url: 'https://ghost.org/docs/'})
});
logging.error(error);
sentry.captureException(error);
} else {
logging.error(new errors.GhostError({
error = new errors.GhostError({
err: err,
message: err.message,
context: i18n.t('errors.services.ping.requestFailed.error', {service: 'xmlrpc'}),
help: i18n.t('errors.services.ping.requestFailed.help', {url: 'https://ghost.org/docs/'})
}));
});
}
logging.error(error);
sentry.captureException(error);
});
});
}