Exception: MmGPSError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- MmGPSError
- 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
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(msg = "Error in MmGPS class", data = {}) ⇒ MmGPSError
constructor
A new instance of MmGPSError.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
18 19 20 |
# File 'lib/mm_gps/mm_gps_module.rb', line 18 def data @data end |