WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0609c15

Browse files
authored
Merge pull request #2947 from guardian/mm/error-handler-logs
Logs | Add error logs for server side csrf and recaptcha errors
2 parents 97de071 + 4242787 commit 0609c15

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/server/lib/middleware/errorHandler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const routeErrorHandler = (
2121
// we attempt to redirect to res.locals.csrf.pageUrl provided by a hidden form field falling back to req.url
2222
// we use res.locals.csrf.pageUrl since the URL might not be GET-able if the request was a POST
2323
// we also have to manually build the query params object, as it may not be defined in an unexpected csrf error
24+
logger.error('csrf error', err);
2425
res.redirect(
2526
303,
2627
addQueryParamsToUntypedPath(
@@ -34,6 +35,7 @@ export const routeErrorHandler = (
3435
return next(err);
3536
} else if (err.code === 'EBADRECAPTCHA') {
3637
trackMetric('RecaptchaMiddleware::Failure');
38+
logger.error('recaptcha error', err);
3739
res.redirect(
3840
303,
3941
addQueryParamsToUntypedPath(

0 commit comments

Comments
 (0)