A nice lib to get more detailed description for System Error messages get from nodejs, based on Error code.
The lib supports multilanguage, easy it is very easy to change the message for each code.
The messages in english were taken from the nodejs docs link
npm install node-errors-for-humans --save
var errorForHumans = require("node-errors-for-humans");
try {
...
} catch(err) {
// err.code == "ECONNREFUSED"
err.toHumans();
}
// output: (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host. (ECONNREFUSED)
var errorForHumans = require("node-errors-for-humans");
errorForHumans.humanLanguage = "en";
var errorForHumans = require("node-errors-for-humans");
errorForHumans.setMessageDictionary({
"ECONNREFUSED": "A conexao foi rejeitada"
}, "pt-br");
var errorForHumans = require("node-errors-for-humans");
errorForHumans.setCodeHumanMessage("ECONNREFUSED", "A conexao foi rejeitada!", "pt-br");