Improved error display in Sentry for theme responses

refs: https://github.com/TryGhost/Team/issues/1369

Change already made for JSON responses in @tryghost/mw-error-handler, but this change also fixes the order of operations for displaying theme errors.
This commit is contained in:
Sam Lord 2022-03-11 10:58:33 +00:00
parent 42ac8c41e4
commit 1025be91d8
3 changed files with 133 additions and 9 deletions

View File

@ -84,10 +84,10 @@ const themeErrorRenderer = (err, req, res, next) => {
};
module.exports.handleThemeResponse = [
// Make sure the error can be served
prepareError,
// Handle the error in Sentry
sentry.errorHandler,
// Make sure the error can be served
prepareError,
// Render the error using theme template
themeErrorRenderer
];

View File

@ -69,7 +69,7 @@
"@tryghost/domain-events": "0.1.8",
"@tryghost/email-analytics-provider-mailgun": "1.0.7",
"@tryghost/email-analytics-service": "1.0.5",
"@tryghost/errors": "1.2.4",
"@tryghost/errors": "1.2.5",
"@tryghost/express-dynamic-redirects": "0.2.6",
"@tryghost/helpers": "1.1.59",
"@tryghost/image-transform": "1.0.28",
@ -91,7 +91,7 @@
"@tryghost/members-stripe-service": "0.9.0",
"@tryghost/metrics": "1.0.6",
"@tryghost/minifier": "0.1.11",
"@tryghost/mw-error-handler": "0.1.3",
"@tryghost/mw-error-handler": "0.1.4",
"@tryghost/mw-session-from-token": "0.1.28",
"@tryghost/nodemailer": "0.3.14",
"@tryghost/nql": "0.9.0",

134
yarn.lock
View File

@ -1962,6 +1962,15 @@
lodash "^4.17.21"
uuid "^8.3.2"
"@tryghost/errors@1.2.5":
version "1.2.5"
resolved "https://registry.yarnpkg.com/@tryghost/errors/-/errors-1.2.5.tgz#e3dd6a462364f899e5267e282fe690ecfbdb4ea2"
integrity sha512-6lsnonu7XI556Sg8j8Svlmaoen6DVVnRch3sPFu2Ugohbprzz3eQiJzNXXXaeIRgwBkTcSPHErYNMIf3fiI5Aw==
dependencies:
lodash "^4.17.21"
utils-copy-error "1.0.1"
uuid "^8.3.2"
"@tryghost/errors@^0.2.10", "@tryghost/errors@^0.2.11", "@tryghost/errors@^0.2.14":
version "0.2.17"
resolved "https://registry.yarnpkg.com/@tryghost/errors/-/errors-0.2.17.tgz#9b89f3845256ace5650593f41cc86d64965b56ed"
@ -2323,13 +2332,15 @@
dependencies:
lodash "^4.17.11"
"@tryghost/mw-error-handler@0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@tryghost/mw-error-handler/-/mw-error-handler-0.1.3.tgz#aa6e29c196578e91627c0e1d8ab60b9edc0b56b3"
integrity sha512-cJFnCJxHNurc478UK1rL+mxDeusIbUldgTAtqvR4dx1ZNT9+bfGzGCT9pGzZ+lgDbx1o5kX7llGCKRmXa2w/TA==
"@tryghost/mw-error-handler@0.1.4":
version "0.1.4"
resolved "https://registry.yarnpkg.com/@tryghost/mw-error-handler/-/mw-error-handler-0.1.4.tgz#d2a0cd308cdcf034ea6920434b7b8376dd93946d"
integrity sha512-hST8JPvYwIsx+YkspuC98B7mpwJ/JxF+RYuMMpLQBAX5cUaTsACy/qAz8iMBokqNAUaeNXMWQwEl4KTkvtj8Fg==
dependencies:
"@tryghost/debug" "^0.1.9"
"@tryghost/errors" "1.2.5"
"@tryghost/tpl" "^0.1.8"
lodash "4.17.21"
"@tryghost/mw-session-from-token@0.1.28":
version "0.1.28"
@ -4188,6 +4199,16 @@ console-control-strings@^1.0.0, console-control-strings@^1.1.0, console-control-
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=
const-max-uint32@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/const-max-uint32/-/const-max-uint32-1.0.2.tgz#f009bb6230e678ed874dd2d6a9cd9e3cbfabb676"
integrity sha1-8Am7YjDmeO2HTdLWqc2ePL+rtnY=
const-pinf-float64@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/const-pinf-float64/-/const-pinf-float64-1.0.0.tgz#f6efb0d79f9c0986d3e79f2923abf9b70b63d726"
integrity sha1-9u+w15+cCYbT558pI6v5twtj1yY=
content-disposition@0.5.4:
version "0.5.4"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe"
@ -9634,7 +9655,7 @@ object-inspect@^1.11.0, object-inspect@^1.9.0:
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0"
integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==
object-keys@^1.0.12, object-keys@^1.1.1:
object-keys@^1.0.12, object-keys@^1.0.9, object-keys@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
@ -10860,6 +10881,11 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2"
safe-regex "^1.1.0"
regex-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/regex-regex/-/regex-regex-1.0.0.tgz#9048a1eaeb870f4d480dabc76fc42cdcc0bc3a72"
integrity sha1-kEih6uuHD01IDavHb8Qs3MC8OnI=
regexp-tree@^0.1.24, regexp-tree@~0.1.1:
version "0.1.24"
resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.24.tgz#3d6fa238450a4d66e5bc9c4c14bb720e2196829d"
@ -12264,6 +12290,11 @@ type-is@^1.6.4, type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"
type-name@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/type-name/-/type-name-2.0.2.tgz#efe7d4123d8ac52afff7f40c7e4dec5266008fb4"
integrity sha1-7+fUEj2KxSr/9/QMfk3sUmYAj7Q=
typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
@ -12504,11 +12535,50 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
utils-copy-error@1.0.1, utils-copy-error@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-copy-error/-/utils-copy-error-1.0.1.tgz#791de393c0f09890afd59f3cbea635f079a94fa5"
integrity sha1-eR3jk8DwmJCv1Z88vqY18HmpT6U=
dependencies:
object-keys "^1.0.9"
utils-copy "^1.1.0"
utils-copy@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/utils-copy/-/utils-copy-1.1.1.tgz#6e2b97982aa8cd73e1182a3e6f8bec3c0f4058a7"
integrity sha1-biuXmCqozXPhGCo+b4vsPA9AWKc=
dependencies:
const-pinf-float64 "^1.0.0"
object-keys "^1.0.9"
type-name "^2.0.0"
utils-copy-error "^1.0.0"
utils-indexof "^1.0.0"
utils-regex-from-string "^1.0.0"
validate.io-array "^1.0.3"
validate.io-buffer "^1.0.1"
validate.io-nonnegative-integer "^1.0.0"
utils-indexof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/utils-indexof/-/utils-indexof-1.0.0.tgz#20feabf09ef1018b523643e8380e7bc83ec61b5c"
integrity sha1-IP6r8J7xAYtSNkPoOA57yD7GG1w=
dependencies:
validate.io-array-like "^1.0.1"
validate.io-integer-primitive "^1.0.0"
utils-merge@1.0.1, utils-merge@1.x.x:
version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
utils-regex-from-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/utils-regex-from-string/-/utils-regex-from-string-1.0.0.tgz#fe1a2909f8de0ff0d5182c80fbc654d6a687d189"
integrity sha1-/hopCfjeD/DVGCyA+8ZU1qaH0Yk=
dependencies:
regex-regex "^1.0.0"
validate.io-string-primitive "^1.0.0"
uuid@8.3.2, uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
@ -12558,6 +12628,60 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
validate.io-array-like@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/validate.io-array-like/-/validate.io-array-like-1.0.2.tgz#7af9f7eb7b51715beb2215668ec5cce54faddb5a"
integrity sha1-evn363tRcVvrIhVmjsXM5U+t21o=
dependencies:
const-max-uint32 "^1.0.2"
validate.io-integer-primitive "^1.0.0"
validate.io-array@^1.0.3:
version "1.0.6"
resolved "https://registry.yarnpkg.com/validate.io-array/-/validate.io-array-1.0.6.tgz#5b5a2cafd8f8b85abb2f886ba153f2d93a27774d"
integrity sha1-W1osr9j4uFq7L4hroVPy2Tond00=
validate.io-buffer@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/validate.io-buffer/-/validate.io-buffer-1.0.2.tgz#852d6734021914d5d13afc32531761e3720ed44e"
integrity sha1-hS1nNAIZFNXROvwyUxdh43IO1E4=
validate.io-integer-primitive@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/validate.io-integer-primitive/-/validate.io-integer-primitive-1.0.0.tgz#a9aa010355fe8681c0fea6c1a74ad2419cadddc6"
integrity sha1-qaoBA1X+hoHA/qbBp0rSQZyt3cY=
dependencies:
validate.io-number-primitive "^1.0.0"
validate.io-integer@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/validate.io-integer/-/validate.io-integer-1.0.5.tgz#168496480b95be2247ec443f2233de4f89878068"
integrity sha1-FoSWSAuVviJH7EQ/IjPeT4mHgGg=
dependencies:
validate.io-number "^1.0.3"
validate.io-nonnegative-integer@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/validate.io-nonnegative-integer/-/validate.io-nonnegative-integer-1.0.0.tgz#8069243a08c5f98e95413c929dfd7b18f3f6f29f"
integrity sha1-gGkkOgjF+Y6VQTySnf17GPP28p8=
dependencies:
validate.io-integer "^1.0.5"
validate.io-number-primitive@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/validate.io-number-primitive/-/validate.io-number-primitive-1.0.0.tgz#d2e01f202989369dcf1155449564203afe584e55"
integrity sha1-0uAfICmJNp3PEVVElWQgOv5YTlU=
validate.io-number@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/validate.io-number/-/validate.io-number-1.0.3.tgz#f63ffeda248bf28a67a8d48e0e3b461a1665baf8"
integrity sha1-9j/+2iSL8opnqNSODjtGGhZluvg=
validate.io-string-primitive@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/validate.io-string-primitive/-/validate.io-string-primitive-1.0.1.tgz#b8135b9fb1372bde02fdd53ad1d0ccd6de798fee"
integrity sha1-uBNbn7E3K94C/dU60dDM1t55j+4=
validator@13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.0.0.tgz#0fb6c6bb5218ea23d368a8347e6d0f5a70e3bcab"