Error handling refactoring in passport.js config