Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / web / middlewares / token-error-handler.js
blobe5c4dee9927a9888862d87481a829caab7cad282
1 'use strict';
3 var env = require('gitter-web-env');
4 var winston = env.logger;
5 var logoutDestroyTokens = require('./logout-destroy-tokens');
7 /* Has to have four args */
8 module.exports = function(err, req, res, next) {
9 if (!req.skipTokenErrorHandler && err && err.gitterAction === 'logout_destroy_user_tokens') {
10 winston.info('token-error-handler: logout_destroy_user_tokens error caught');
12 return logoutDestroyTokens(req, res, next);
15 return next(err);