diff --git a/app/utils/response-router.js b/app/utils/response-router.js index b3c081e46..d9a7e8f06 100644 --- a/app/utils/response-router.js +++ b/app/utils/response-router.js @@ -274,7 +274,7 @@ function logErrorPageShown (page, reason, loggingFields, error) { logger.info('Rendering error response', { page, reason, - error, + error: (error && error.message) || error, ...loggingFields }) } diff --git a/test/utils/response-router.test.js b/test/utils/response-router.test.js index 42f1642ff..4b93a8798 100644 --- a/test/utils/response-router.test.js +++ b/test/utils/response-router.test.js @@ -122,7 +122,7 @@ describe('rendering behaviour', () => { }) it('should render error response', () => { - responseRouter.errorResponse(request, response, 'A reason', { returnUrl: 'http://example.com' }, 'err') + responseRouter.errorResponse(request, response, 'A reason', { returnUrl: 'http://example.com' }, new Error('err')) expect(render.lastCall.args).to.deep.equal(['error', { returnUrl: 'http://example.com', viewName: 'ERROR', @@ -136,7 +136,7 @@ describe('rendering behaviour', () => { }) it('should render system error response', () => { - responseRouter.systemErrorResponse(request, response, 'A reason', { returnUrl: 'http://example.com' }, 'err') + responseRouter.systemErrorResponse(request, response, 'A reason', { returnUrl: 'http://example.com' }, new Error('err')) expect(render.lastCall.args).to.deep.equal(['errors/system-error', { returnUrl: 'http://example.com', viewName: 'SYSTEM_ERROR'