I have some Node.js code that is trying to update the database something like this:
connection.query(command, function(err,rows) { if (err){ console.log(command); console.log("ERROR"); console.log(err); return; } console.log("good"); });
The above is performed repeatedly for different values ββof the "command", thereby generating different queries to the database. The problem is that when an error occurs in console.log(command) request is incorrect. This is due to the fact that the time of adding a request to the queue and the time of the actual execution of the request do not match, therefore the value of the command at each of these time points is not the same. Is there a way around this?
Note: console.log(err) prints the error itself, as well as part of the request, but prints only the line where the error occurred. I want to print the entire request.
source share