Added sentry logging to 429 ping errors

issue https://github.com/TryGhost/Team/issues/362
This commit is contained in:
Thibaut Patel 2021-02-18 19:21:15 +01:00
parent a2dd7c7f7d
commit 6e58846c94

View File

@ -7,6 +7,7 @@ const {events, i18n} = require('../lib/common');
const logging = require('../../shared/logging');
const request = require('../lib/request');
const settingsCache = require('./settings/cache');
const sentry = require('../../shared/sentry');
const defaultPostSlugs = [
'welcome',
@ -83,12 +84,14 @@ function ping(post) {
})
.catch(function (err) {
if (err.statusCode === 429) {
logging.error(new errors.TooManyRequestsError({
const 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({
err: err,