Exception: Tapyrus::RPC::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Tapyrus::RPC::Error
- Defined in:
- lib/tapyrus/rpc/tapyrus_core_client.rb
Overview
Throw when happened anything http’s error with connect to server.
Almost case this exception happened from 401 Unauthorized or 500 Internal Server Error. And also, throw by cause of other http’s errors.
You can pull RPC error message when happened 500 Internal Server Error, like below:
rescue Tapyrus::RPC::Error => ex
if ex..response_code == 500
puts ex.[:rpc_error]
end
end
Instance Attribute Summary collapse
-
#response_code ⇒ Object
readonly
Returns the value of attribute response_code.
-
#response_msg ⇒ Object
readonly
Returns the value of attribute response_msg.
-
#rpc_error ⇒ Object
readonly
Returns the value of attribute rpc_error.
Instance Method Summary collapse
-
#initialize(response_code, response_msg, rpc_error) ⇒ Error
constructor
A new instance of Error.
-
#message ⇒ String
Return string that represents error message.
-
#response ⇒ Hash
Return response object as Hash.
- #to_s ⇒ Object
Constructor Details
#initialize(response_code, response_msg, rpc_error) ⇒ Error
Returns a new instance of Error.
21 22 23 24 25 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 21 def initialize(response_code, response_msg, rpc_error) @response_code = response_code @response_msg = response_msg @rpc_error = rpc_error end |
Instance Attribute Details
#response_code ⇒ Object (readonly)
Returns the value of attribute response_code.
19 20 21 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 19 def response_code @response_code end |
#response_msg ⇒ Object (readonly)
Returns the value of attribute response_msg.
19 20 21 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 19 def response_msg @response_msg end |
#rpc_error ⇒ Object (readonly)
Returns the value of attribute rpc_error.
19 20 21 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 19 def rpc_error @rpc_error end |
Instance Method Details
#message ⇒ String
Return string that represents error message.
43 44 45 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 43 def response.to_json end |
#response ⇒ Hash
Return response object as Hash
32 33 34 35 36 37 38 39 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 32 def response @response ||= begin m = { response_code: response_code, response_msg: response_msg } m.merge!(rpc_error: rpc_error) if rpc_error m end end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 47 def to_s end |