0
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);
  });
});

in my c# I have

IRestResponse response = client.Execute(request);
var content = response.Content; 

but the content prints "Internal Error" for all err types

EDIT Also tried:

pool.getConnection((err, conn) => {
    if(err) {
        var error = new Error("something is wrong");
        callback(error);
    }

according to this https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html, still getting Internal Error for all error types

Also, I do get 200 OK on good requests, what I am trying to do is to print an explanatory message to the client in case of an error

user829174
  • 6,132
  • 24
  • 75
  • 125
  • Are you sure that given credentials are correct? – Nubzor Mar 21 '19 at 11:11
  • that is because the link you provided show how to get AWS Lambda errors, but here you're getting MySQL connection errors. Check if [this helps](https://stackoverflow.com/questions/40141332/node-js-mysql-error-handling) – Gonzalo.- Mar 22 '19 at 02:20

0 Answers0