File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
packages/node_modules/@node-red/nodes/core/network Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -991,14 +991,21 @@ module.exports = function(RED) {
991
991
}
992
992
993
993
if ( topicOK ) {
994
- node . client . publish ( msg . topic , msg . payload , options , function ( err ) {
995
- done && done ( err ) ;
996
- return
997
- } ) ;
994
+ node . client . publish ( msg . topic , msg . payload , options , function ( err ) {
995
+ if ( done ) {
996
+ done ( err )
997
+ } else {
998
+ node . error ( err , msg )
999
+ }
1000
+ } )
998
1001
} else {
999
- const error = new Error ( RED . _ ( "mqtt.errors.invalid-topic" ) ) ;
1000
- error . warn = true ;
1001
- done ( error ) ;
1002
+ const error = new Error ( RED . _ ( "mqtt.errors.invalid-topic" ) )
1003
+ error . warn = true
1004
+ if ( done ) {
1005
+ done ( error )
1006
+ } else {
1007
+ node . warn ( error , msg )
1008
+ }
1002
1009
}
1003
1010
}
1004
1011
} ;
You can’t perform that action at this time.
0 commit comments