我正在尝试使用restify来运行服务器节点。我有这个错误:
func addProduct(objectId: String, name: String, price: Double, qty: Int, img: String = "", desc: String = "", note: String = "") {
if !(self.order?.detail.contains(where: { $0.objectId == objectId }) ?? true) {
order?.addToDetail(Product(objectId: objectId, name: name, price: price, qty: qty, img: img, desc: desc, note: note))
}
// ... remove the logging
}
我的服务器节点代码是:
throw (new Error('too few args to sprintf'));
我的存储过程是:
function callPost(req, res, next) {
var user = {};
user.nombre = req.params.nombre;
user.apellido = req.params.apellido;
user.email = req.params.email;
user.telefono = req.params.telefono;
user.dirig = req.params.dirig;
user.mensaje = req.params.mensaje;
//user.idform = req.params.idform; user.fecha = req.params.fecha;
var formu = "2";
var sql = "call sp_contacto(?,?,?,?,?,?,?,?)";
res.setHeader('Access-Control-Allow-Origin', '*');
connection.query(sql, [user.nombre, user.apellido, user.email, user.telefono, user.dirig, user.mensaje, formu, user.fecha],
function (error, success) {
if (error) throw error;
console.log(success);
res.send(200, success.insertId);
}
);
}
错误的原因是什么?
答案 0 :(得分:0)
解决方案:
<强>的console.log(误差); 强>
之前:
res.send(200,success.insertId);