Exception: Farcall::RemoteError
- Defined in:
- lib/farcall/transport.rb
Overview
The error occured while executin remote method. Inf an exception is raused while executing remote method, it will be passed back and raised in the caller thread with an instance of this class.
The remote can throw regular or extended errors. Extended errors can pass any data to the other end, which will be available as #data.
To carry error data just raise any exception which respnd_to(:data), which should return hash with any application specific error data, as in this sample error class:
class MyError < StandardError
def data
{ foo: }
end
end
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
data passed by the remote error or an empty hash.
-
#remote_class ⇒ Object
readonly
The class of the remote error.
Instance Method Summary collapse
-
#initialize(remote_class, text, data = {}) ⇒ RemoteError
constructor
A new instance of RemoteError.
Constructor Details
permalink #initialize(remote_class, text, data = {}) ⇒ RemoteError
Returns a new instance of RemoteError.
29 30 31 32 |
# File 'lib/farcall/transport.rb', line 29 def initialize remote_class, text, data={} @remote_class, @data = remote_class, data super "#{remote_class}: #{text}" end |
Instance Attribute Details
permalink #data ⇒ Object (readonly)
data passed by the remote error or an empty hash
27 28 29 |
# File 'lib/farcall/transport.rb', line 27 def data @data end |
permalink #remote_class ⇒ Object (readonly)
The class of the remote error. Usually string name of the class or any other useful string identifier.
25 26 27 |
# File 'lib/farcall/transport.rb', line 25 def remote_class @remote_class end |