Skip to content

Thread termination with exception not handled? #142

@phlegx

Description

@phlegx

With this simple implementation, I get an exception after broker goes down for some reason.

client.subscribe('test' => 0)
client.get do |topic, message|
  # Block is executed for every message received
end

Here the log:

/usr/local/bundle/bundler/gems/ruby-mqtt/lib/mqtt/packet.rb:222:in `getbyte': Connection reset by peer @ io_fillbuf - fd:5 (Errno::ECONNRESET)
from /usr/local/bundle/bundler/gems/ruby-mqtt/lib/mqtt/packet.rb:222:in `read_byte'
from /usr/local/bundle/bundler/gems/ruby-mqtt/lib/mqtt/packet.rb:30:in `read'
from /usr/local/bundle/bundler/gems/ruby-mqtt/lib/mqtt/client.rb:466:in `receive_packet'
from /usr/local/bundle/bundler/gems/ruby-mqtt/lib/mqtt/client.rb:273:in `block in connect'

How can I rescue from this exception?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions