0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed error reporting to Sentry

no issue

- some errors weren't being reported because they were being passed to
  Sentry before our middleware could populate the error information
- this commit inserts the Sentry middleware into these steps
This commit is contained in:
Daniel Lockyer 2020-02-17 13:26:35 +00:00
parent a8e4492109
commit 28071a242a

View file

@ -4,6 +4,7 @@ const debug = require('ghost-ignition').debug('error-handler');
const config = require('../../../config');
const common = require('../../../lib/common');
const helpers = require('../../../../frontend/services/routing/helpers');
const sentry = require('../../../sentry');
const escapeExpression = hbs.Utils.escapeExpression;
const _private = {};
@ -247,6 +248,8 @@ errorHandler.pageNotFound = (req, res, next) => {
errorHandler.handleJSONResponse = [
// Make sure the error can be served
_private.prepareError,
// Handle the error in Sentry
sentry.errorHandler,
// Render the error using JSON format
_private.JSONErrorRenderer
];
@ -254,6 +257,8 @@ errorHandler.handleJSONResponse = [
errorHandler.handleJSONResponseV2 = [
// Make sure the error can be served
_private.prepareError,
// Handle the error in Sentry
sentry.errorHandler,
// Render the error using JSON format
_private.JSONErrorRendererV2
];
@ -261,6 +266,8 @@ errorHandler.handleJSONResponseV2 = [
errorHandler.handleHTMLResponse = [
// Make sure the error can be served
_private.prepareError,
// Handle the error in Sentry
sentry.errorHandler,
// Render the error using HTML format
_private.HTMLErrorRenderer,
// Fall back to basic if HTML is not explicitly accepted
@ -270,6 +277,8 @@ errorHandler.handleHTMLResponse = [
errorHandler.handleThemeResponse = [
// Make sure the error can be served
_private.prepareError,
// Handle the error in Sentry
sentry.errorHandler,
// Render the error using theme template
_private.ThemeErrorRenderer,
// Fall back to basic if HTML is not explicitly accepted