Exception: DjiMqttConnect::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dji_mqtt_connect/error.rb

Overview

Represents an Error caused when communicatng via MQTT

Direct Known Subclasses

ParseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, message = nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
# File 'lib/dji_mqtt_connect/error.rb', line 8

def initialize(error, message = nil)
  @wrapped_exception, msg = error_and_message(error, message)
  super(msg)
end

Instance Attribute Details

#wrapped_exceptionObject (readonly)

Returns the value of attribute wrapped_exception.



6
7
8
# File 'lib/dji_mqtt_connect/error.rb', line 6

def wrapped_exception
  @wrapped_exception
end

Instance Method Details

#backtraceObject



13
14
15
16
17
18
19
# File 'lib/dji_mqtt_connect/error.rb', line 13

def backtrace
  if @wrapped_exception
    @wrapped_exception.backtrace
  else
    super
  end
end

#inspectObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/dji_mqtt_connect/error.rb', line 21

def inspect
  if @wrapped_exception
    inner = +""
    inner += ": #{message}," if !message.empty? && @wrapped_exception.message != message
    inner << " wrapped=#{@wrapped_exception.inspect}"
    %(#<#{self.class}#{inner}>)
  else
    super
  end
end