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
20 21 22 23 24 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 20 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.
18 19 20 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 18 def response_code @response_code end |
#response_msg ⇒ Object (readonly)
Returns the value of attribute response_msg.
18 19 20 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 18 def response_msg @response_msg end |
#rpc_error ⇒ Object (readonly)
Returns the value of attribute rpc_error.
18 19 20 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 18 def rpc_error @rpc_error end |
Instance Method Details
#message ⇒ String
Return string that represents error message.
42 43 44 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 42 def response.to_json end |
#response ⇒ Hash
Return response object as Hash
31 32 33 34 35 36 37 38 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 31 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
46 47 48 |
# File 'lib/tapyrus/rpc/tapyrus_core_client.rb', line 46 def to_s end |