Exception: MmGPSError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mm_gps/mm_gps_module.rb

Overview

Local Exception class.

The @data attribute holds a Hash with informative content. In particular, @data [:reason] holds a Symbol providing the internal error code, currently one of the following:

  • :notype when the packet type code is neither 1 nor 2

  • :nocrc when the CRC16 check fails

  • :noavail when the serialport was not available for reading (timeout)

Typically, the last raw buffer is available in human readable format as:

rescue MmGPSError => e
  puts MmGPS::hexify(e.data[:packet])
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = "Error in MmGPS class", data = {}) ⇒ MmGPSError

Returns a new instance of MmGPSError.



19
20
21
22
# File 'lib/mm_gps/mm_gps_module.rb', line 19

def initialize(msg="Error in MmGPS class", data={})
  @data = data
  super(msg)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



18
19
20
# File 'lib/mm_gps/mm_gps_module.rb', line 18

def data
  @data
end