From e011ef165bbd09bcfe8d16dbbf1b15846bc9bfc6 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Mon, 16 Jul 2018 11:05:41 +0200 Subject: [PATCH] Add debugging information for maxAge fail --- session/session.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/session/session.js b/session/session.js index fee7608c..cb6ef1d5 100644 --- a/session/session.js +++ b/session/session.js @@ -56,7 +56,13 @@ defineMethod(Session.prototype, 'touch', function touch() { */ defineMethod(Session.prototype, 'resetMaxAge', function resetMaxAge() { - this.cookie.maxAge = this.cookie.originalMaxAge; + try { + this.cookie.maxAge = this.cookie.originalMaxAge; + } catch ( e ) { + const error = new Error('Cannot resetMaxAge on cookie ' + this.cookie + ' on ' + this.req.originalUrl); + error.request = this.req; + throw error; + } return this; });