Exception: MessagePack::RPC::RPCError
- Defined in:
- lib/msgpack/rpc/exception.rb,
lib/msgpack/rpc/exception.rb
Overview
MessagePack-RPC Exception
RPCError
|
+-- TimeoutError
|
+-- TransportError
| |
| +-- NetworkUnreachableError
| |
| +-- ConnectionRefusedError
| |
| +-- ConnectionTimeoutError
| |
| +-- MalformedMessageError
| |
| +-- StreamClosedError
|
+-- CallError
| |
| +-- NoMethodError
| |
| +-- ArgumentError
|
+-- ServerError
| |
| +-- ServerBusyError
|
+-- RemoteError
|
+-- RuntimeError
|
+-- (user-defined errors)
Direct Known Subclasses
CallError, RemoteError, ServerError, TimeoutError, TransportError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, *data) ⇒ RPCError
constructor
A new instance of RPCError.
- #is?(code) ⇒ Boolean
Constructor Details
#initialize(code, *data) ⇒ RPCError
Returns a new instance of RPCError.
63 64 65 66 67 |
# File 'lib/msgpack/rpc/exception.rb', line 63 def initialize(code, *data) @code = code.to_s @data = data super(@data.shift || @code) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
68 69 70 |
# File 'lib/msgpack/rpc/exception.rb', line 68 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
69 70 71 |
# File 'lib/msgpack/rpc/exception.rb', line 69 def data @data end |
Class Method Details
.create(code, data) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/msgpack/rpc/exception.rb', line 175 def self.create(code, data) if code[0] == ?. code = code.dup while true if klass = SYSTEM_ERROR_TABLE[code] return klass.new(*data) end if code.slice!(/\.[^\.]*$/) == nil || code.empty? return RPCError.new(code, *data) end end elsif code == RuntimeError::CODE RuntimeError.new(*data) else RemoteError.new(code, *data) end end |
Instance Method Details
#is?(code) ⇒ Boolean
71 72 73 74 75 76 77 78 79 |
# File 'lib/msgpack/rpc/exception.rb', line 71 def is?(code) if code.is_a?(Class) && code < RPCError if code == RemoteError return @code[0] != ?. end code = code::CODE end @code == code || @code[0,code.length+1] == "#{code}." end |