Added logging for members-ssr errors

no-issue

This will help us debug issues with members-ssr functionality going forward
This commit is contained in:
Fabien O'Carroll 2019-07-24 18:05:05 +08:00
parent 2b6830b747
commit 805f3c7250

View File

@ -4,6 +4,7 @@ const express = require('express');
// App requires
const config = require('../../config');
const common = require('../../lib/common');
const apps = require('../../services/apps');
const constants = require('../../lib/constants');
const storage = require('../../adapters/storage');
@ -97,6 +98,7 @@ module.exports = function setupSiteApp(options = {}) {
res.writeHead(200);
res.end();
}).catch((err) => {
common.logging.error(err);
res.writeHead(err.statusCode);
res.end(err.message);
});
@ -106,6 +108,7 @@ module.exports = function setupSiteApp(options = {}) {
res.writeHead(204);
res.end();
}).catch((err) => {
common.logging.error(err);
res.writeHead(err.statusCode);
res.end(err.message);
});
@ -114,8 +117,8 @@ module.exports = function setupSiteApp(options = {}) {
membersService.ssr.getMemberDataFromSession(req, res).then((member) => {
req.member = member;
next();
}).catch(() => {
// @TODO log error?
}).catch((err) => {
common.logging.error(err);
req.member = null;
next();
});