Exception: Paho::Exception

Inherits:
StandardError
  • Object
show all
Defined in:
lib/paho/exception.rb

Overview

Exception class that acts as a wrapper over the MqttException Java counterpart.

Usage:

begin
  client.connect # This will trigger a org.eclipse.paho.client.mqttv3.MqttException
rescue Paho::Exception => ex
  ex.message #=> Client exception: bla bla
end

Constant Summary collapse

DEFAULT_REASON_CODE =
0
REASON_CODE =
{
  # General errors
  0 => 'Client exception',
  1 => 'Invalid protocol version',
  2 => 'Invalid client ID',
  3 => 'Broken unavailable',
  4 => 'Failed authentication',
  5 => 'Not authorized',
  6 => 'Unexpected error',

  # Subscription errors
  128 => 'Subscribe failed',

  32000 => 'Client timeout',
  32001 => 'No message IDs available',

  # Connection errors
  32100 => 'Client connected',
  32101 => 'Client already disconnected',
  32102 => 'Client disconnecting',
  32103 => 'Server connect error',
  32104 => 'Client not connected',
  32105 => 'Socket factory mismatch',
  32106 => 'SSL configuration error',
  32107 => 'Client disconnect prohibited',
  32108 => 'Invalid message',
  32109 => 'Connection lost',
  32110 => 'Connect in progress',
  32111 => 'Client closed',

  32201 => 'Token in use',
  32202 => 'Maximum in flight messages'
}

Instance Method Summary collapse

Constructor Details

#initialize(err) ⇒ Exception

Returns a new instance of Exception.


49
50
51
52
53
# File 'lib/paho/exception.rb', line 49

def initialize(err)
  set_backtrace(err.backtrace)

  super "#{err.getMessage} (#{err.getCause})"
end