winstonjs / winston-syslog

A syslog transport for winston
http://github.com/winstonjs/winston-syslog
MIT License
138 stars 119 forks source link

Catch exceptions throwdn by socket send #165

Closed Apollon77 closed 2 years ago

Apollon77 commented 2 years ago

We experience sometimes issues where udp socket send throws an exception, see https://sentry.iobroker.net/share/issue/0fe0c0c9a1f94a12a06676ee2195f5ef/

This PR catches this and calls callback with the error, fixes #161

Apollon77 commented 2 years ago

@DABH Thank you for checking and accepting. Would be great if I could upgrade the dep before releaseing a new major ioBroker version "soon"

wbt commented 2 years ago

I was under the impression that the callback function was a continuation to be called in the success case, not an error handler, but I'm also not seeing good documentation on that. #1250 seems possibly relevant.

Apollon77 commented 2 years ago

https://github.com/winstonjs/winston-syslog/blob/master/lib/winston-syslog.js#L233 here you see that the chunkMessage is called with "onError method as callback and this has also code to handle errors

Apollon77 commented 2 years ago

@DABH what do you think?

DABH commented 2 years ago

@Apollon77 Sorry for slow reply. Your suggestion/evidence makes sense to me. It's possible that the intent was to have callback also be something that is called on success, but regardless, it seems like it should at least be called on error.

DABH commented 2 years ago

@Apollon77 I released v2.5.0, cheers!

Apollon77 commented 2 years ago

Thank you very much, I will pick up on our side too for the next Beta release. Perfect timing :-)

wbt commented 2 years ago

(the deleted comment was a duplicate)