export function asyncHandler(handler) { return async function wrappedHandler(req, res, next) { try { await handler(req, res, next); } catch (error) { next(error); } }; }