Exception: Phidgets::Exception

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/phidgets/common.rb

Constant Summary collapse

EPHIDGET_NOTFOUND =
1
EPHIDGET_NOMEMORY =
2
EPHIDGET_UNEXPECTED =
3
EPHIDGET_INVALIDARG =
4
EPHIDGET_NOTATTACHED =
5
EPHIDGET_INTERRUPTED =
6
EPHIDGET_INVALID =
7
EPHIDGET_NETWORK =
8
EPHIDGET_UNKNOWNVAL =
9
EPHIDGET_BADPASSWORD =
10
EPHIDGET_UNSUPPORTED =
11
EPHIDGET_DUPLICATE =
12
EPHIDGET_TIMEOUT =
13
EPHIDGET_OUTOFBOUNDS =
14
EPHIDGET_EVENT =
15
EPHIDGET_NETWORK_NOTCONNECTED =
16
EPHIDGET_WRONGDEVICE =
17
EPHIDGET_CLOSED =
18
EPHIDGET_BADVERSION =
19

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Exception

Returns a new instance of Exception.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/phidgets/common.rb', line 88

def initialize(code)
  @code = code
  case code
    when -2
      super('Failed to load Phidgets Library')
    when -1
      super('Unable to determine Phidgets Library name.')
    when EPHIDGET_NOTFOUND
      super('A Phidget matching the type and or serial number could not be found.')
    when EPHIDGET_NOMEMORY
      super('Memory could not be allocated.')
    when EPHIDGET_UNEXPECTED
      super('Unexpected Error. Contact Phidgets Inc. for support.')
    when EPHIDGET_INVALIDARG
      super('Invalid argument passed to function.')
    when EPHIDGET_NOTATTACHED
      super('Phidget not physically attached.')
    when EPHIDGET_INTERRUPTED
      super('Read/Write operation was interrupted.')
    when EPHIDGET_INVALID
      super('The Error Code is not defined.')
    when EPHIDGET_NETWORK
      super('Network Error.')
    when EPHIDGET_UNKNOWNVAL
      super('Value is Unknown (State not yet received from device, or not yet set by user).')
    when EPHIDGET_BADPASSWORD
      super('Authorization Failed.')
    when EPHIDGET_UNSUPPORTED
      super('Not Supported.')
    when EPHIDGET_DUPLICATE
      super('Duplicated request.')
    when EPHIDGET_TIMEOUT
      super('Given timeout has been exceeded.')
    when EPHIDGET_OUTOFBOUNDS
      super('Index out of Bounds.')
    when EPHIDGET_EVENT
      super('A non-null error code was returned from an event handler.')
    when EPHIDGET_NETWORK_NOTCONNECTED
      super('A connection to the server does not exist.')
    when EPHIDGET_WRONGDEVICE
      super('Function is not applicable for this device.')
    when EPHIDGET_CLOSED
      super('Phidget handle was closed.')
    when EPHIDGET_BADVERSION
      super('Webservice and Client protocol versions don’t match. Update to newest release.')
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



66
67
68
# File 'lib/phidgets/common.rb', line 66

def code
  @code
end