add utils.inspect result and be more explicit about the error.

This commit is contained in:
Simon Hailes 2019-11-02 10:39:22 +00:00
parent bc283aa025
commit eb09ec6834

View File

@ -784,9 +784,12 @@ function encodeObject(msg,opts) {
errorMsg.name = e.name;
}
if (e.hasOwnProperty('message')) {
errorMsg.message = e.message;
errorMsg.message = 'encodeObject Error: ['+e.message + '] Value: '+util.inspect(msg.msg);
} else {
errorMsg.message = e.toString();
errorMsg.message = 'encodeObject Error: ['+e.toString() + '] Value: '+util.inspect(msg.msg);
}
if (errorMsg.message.length > debuglength) {
errorMsg.message = errorMsg.message.substring(0,debuglength);
}
msg.msg = JSON.stringify(errorMsg);
return msg;