diff --git a/lib/render.js b/lib/render.js index 372301f8..bf05865d 100644 --- a/lib/render.js +++ b/lib/render.js @@ -75,7 +75,7 @@ function renderComponent(req, res, hrStart) { options = options || {}; if (renderer instanceof Error) { - log('error', renderer); + log('error', renderer, { url: res.locals.url }); return Promise.reject(renderer); } // Add request route params, request query params @@ -88,7 +88,7 @@ function renderComponent(req, res, hrStart) { .then(cmptData => formDataForRenderer(cmptData, { _ref }, locals)) .tap(logTime(hrStart, _ref)) .then(({data, options}) => renderer.render(data, options, res)) - .catch(err => log('error', err)); + .catch(err => log('error', err, { url: res.locals.url })); } /** diff --git a/lib/responses.js b/lib/responses.js index 51321100..eec7a2c1 100644 --- a/lib/responses.js +++ b/lib/responses.js @@ -284,7 +284,7 @@ function notFound(err, res) { */ function serverError(err, res) { // error is required to be logged - log('error', err.message, { stack: err.stack }); + log('error', err.message, { stack: err.stack, url: res.locals.url }); const message = err.message || 'Server Error', // completely hide these messages from outside code = 500; @@ -312,7 +312,7 @@ function unauthorized(res) { * @param {object} res */ function clientError(err, res) { - log('error', err.message, { stack: err.stack }); + log('error', err.message, { stack: err.stack, url: res.locals.url }); // They know it's a 400 already, we don't need to repeat the fact that its an error. const message = removePrefix(err.message, ':'), code = 400;