You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When my authentication middleware is throwing an exception (see code below), an 'UnhandledPromiseRejectionWarning" is issued. The exception is not propagated further, which causes problems in my program.
This problem did not exist in the previous version 0.5.0.
export function requiresAuth(req, res, next) {
if (req.session && req.session.user && req.session.user.id) {
return next();
} else {
throw new NoValidSessionError('requiresAuth');
}
}
requiresAuth.unless = require('express-unless');
This has become a bigger issue in newer node versions since now unhandled rejections crash the process. Also note that Express v5 will handle promise rejections and forward to error handlers so it might be worth to do that in this middleware as well. The fix should be pretty easy I think
When my authentication middleware is throwing an exception (see code below), an 'UnhandledPromiseRejectionWarning" is issued. The exception is not propagated further, which causes problems in my program.
This problem did not exist in the previous version 0.5.0.
Possible fix in index.js:
The text was updated successfully, but these errors were encountered: