instead of :
if (!foundUser) return next(createError.NotFound("User not found"));
i want to send an object like this :
if(!foundUser)returnnext(createError.NotFound({field : "email",message: "User not found"}));// the same as : res.status(404).json({field:"email", message:"User not found"})
instead of :
if (!foundUser) return next(createError.NotFound("User not found"));i want to send an object like this :