Moved Sentry noop function into block

- this function can be reduced in scope as it's only used in one of the
  branches
This commit is contained in:
Daniel Lockyer 2020-11-10 11:04:21 +00:00
parent 36fb04f735
commit f568c4a65e

View File

@ -2,10 +2,6 @@ const config = require('./config');
const sentryConfig = config.get('sentry');
const errors = require('@tryghost/errors');
const expressNoop = function (req, res, next) {
next();
};
if (sentryConfig && !sentryConfig.disabled) {
const Sentry = require('@sentry/node');
const version = require('../server/lib/ghost-version').full;
@ -34,6 +30,10 @@ if (sentryConfig && !sentryConfig.disabled) {
captureException: Sentry.captureException
};
} else {
const expressNoop = function (req, res, next) {
next();
};
module.exports = {
requestHandler: expressNoop,
errorHandler: expressNoop,