File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,16 @@ module.exports = function(RED) {
7979 function sendDebug ( msg ) {
8080 if ( msg . msg instanceof Error ) {
8181 msg . format = "error" ;
82- msg . msg = msg . msg . toString ( ) ;
82+ var errorMsg = { } ;
83+ if ( msg . msg . name ) {
84+ errorMsg . name = msg . msg . name ;
85+ }
86+ if ( msg . msg . hasOwnProperty ( 'message' ) ) {
87+ errorMsg . message = msg . msg . message ;
88+ } else {
89+ errorMsg . message = msg . msg . toString ( ) ;
90+ }
91+ msg . msg = JSON . stringify ( errorMsg ) ;
8392 } else if ( msg . msg instanceof Buffer ) {
8493 msg . format = "buffer[" + msg . msg . length + "]" ;
8594 msg . msg = msg . msg . toString ( 'hex' ) ;
Original file line number Diff line number Diff line change @@ -230,8 +230,11 @@ RED.debug = (function() {
230230 ( o . property ?'msg.' + property :'msg' ) + " : " + format +
231231 '</span>' ) . appendTo ( metaRow ) ;
232232 }
233- if ( format === 'Object' || / ^ a r r a y / . test ( format ) || format === 'boolean' || format === 'number' || / e r r o r / i . test ( format ) ) {
233+ if ( format === 'Object' || / ^ a r r a y / . test ( format ) || format === 'boolean' || format === 'number' ) {
234234 payload = JSON . parse ( payload ) ;
235+ } else if ( / e r r o r / i. test ( format ) ) {
236+ payload = JSON . parse ( payload ) ;
237+ payload = ( payload . name ?payload . name + ": " :"" ) + payload . message ;
235238 } else if ( format === 'null' ) {
236239 payload = null ;
237240 } else if ( format === 'undefined' ) {
You can’t perform that action at this time.
0 commit comments