Class: Exception::DRoby
Overview
An intermediate representation of Exception objects suitable to be sent to our peers.
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model, message) ⇒ DRoby
constructor
A new instance of DRoby.
-
#proxy(peer) ⇒ Object
Returns a local representation of the exception object
selfdescribes.
Constructor Details
#initialize(model, message) ⇒ DRoby
Returns a new instance of DRoby.
500 |
# File 'lib/roby/distributed/protocol.rb', line 500 def initialize(model, ); @model, = model, end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
499 500 501 |
# File 'lib/roby/distributed/protocol.rb', line 499 def end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
499 500 501 |
# File 'lib/roby/distributed/protocol.rb', line 499 def model @model end |
Instance Method Details
#proxy(peer) ⇒ Object
Returns a local representation of the exception object self describes. If the real exception message is not available, it reuses the more-specific exception class which is available.
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
# File 'lib/roby/distributed/protocol.rb', line 505 def proxy(peer) error_model = model.proxy(peer) error_model.exception(self.) rescue ArgumentError # try to get a less-specific error model which does allow a simple # message. In the worst case, we will fall back to Exception itself # # However, include the real model name in the message = "#{self.message} (#{model.ancestors.first.first})" for model in error_model.ancestors next unless model.kind_of?(Class) begin return model.exception() rescue ArgumentError end end end |