zevv / nmqtt

Native Nim MQTT client library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connect() does not raise exception on error

srd424 opened this issue · comments

I've got a "one-shot" program that publishes a few values then quits, so I'm calling connect() instead of start(), but unfortunately this doesn't seem to raise an exception if the TCP connection fails.

I contemplated using isConnected() to check, but I think it's possible for TCP connection to have completed OK but for the MQTT handshake not to have done, in which case the state won't be "connected"` yet?

#40 is the least invasive fix, though looking at the code I think it's probably possible to move the try/except from connectBroker to runConnect.