DEV Community

Discussion on: Central Error Handling in Express

Collapse
 
oim5nu profile image
Yuanpeng Zheng

Great post. Buddy. Just got one question here.

const validateUser = async (req, res, next) => {
  try {
    .....
    next()
  } catch (error) {
    next(error)
  }

  res.on('finish', () => {
     // How could you handle the error here for express? Thanks. 
  }
}