/** * @module Wrapper for handling errors in asynchronous middleware functions. * * @param {Function} fn - Asynchronous middleware function to process the request and response. * @returns {Function} - Middleware that passes errors to the Express error handler. */ module.exports = (fn) => { return (req, res, next) => { fn(req, res, next).catch(next); }; };