I am requesting a API that throw an error but I cannot get the error message.
This is how the API return the error:
res.status(500).send(JSON.stringify({
status: 500,
message: "Error during insertion" + err.message,
}));
This is how I am trying to catch that message.
error: function(res) {
console.log("Error: " + res.message);
ierror = 1;
}
Any idea how i can do it?