var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers", function (err, result, fields) {
if (err) throw err;
console.log(result);
});
});
我的C#中有
IRestResponse response = client.Execute(request);
var content = response.Content;
但是内容会为所有错误类型打印“内部错误”
编辑 还尝试过:
pool.getConnection((err, conn) => {
if(err) {
var error = new Error("something is wrong");
callback(error);
}
根据此https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html,对于所有错误类型,仍然会收到内部错误
此外,我的请求得到200的确认,我想做的是在出现错误的情况下向客户端打印说明性消息