Exception: Roby::LocalizedError
- Defined in:
- lib/roby/standard_errors.rb
Overview
This kind of errors are generated during the plan execution, allowing to blame a fault on a plan object (#failure_point). The precise failure point is categorized in the #failed_event, #failed_generator and #failed_task. It is guaranteed that one of #failed_generator and #failed_task is non-nil.
Direct Known Subclasses
ChildFailedError, CodeError, EventCanceled, EventNotControlable, EventNotExecutable, EventPreconditionFailed, MissionFailedError, PlanningFailedError, TaskNotExecutable, TaskStructure::ExecutionAgentSpawningFailed, UnreachableEvent
Instance Attribute Summary collapse
-
#failed_event ⇒ Object
readonly
The objects of the given categories which are related to #failure_point.
-
#failed_generator ⇒ Object
readonly
The objects of the given categories which are related to #failure_point.
-
#failed_task ⇒ Object
readonly
The objects of the given categories which are related to #failure_point.
-
#failure_point ⇒ Object
readonly
The object describing the point of failure.
Instance Method Summary collapse
-
#initialize(failure_point) ⇒ LocalizedError
constructor
Create a LocalizedError object with the given failure point.
-
#involved_plan_object?(obj) ⇒ Boolean
True if
objis involved in this error. - #pretty_print(pp) ⇒ Object
Constructor Details
#initialize(failure_point) ⇒ LocalizedError
Create a LocalizedError object with the given failure point
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/roby/standard_errors.rb', line 16 def initialize(failure_point) @failure_point = failure_point if failure_point.kind_of?(Event) @failed_event = failure_point @failed_generator = failure_point.generator elsif failure_point.kind_of?(EventGenerator) @failed_generator = failure_point elsif failure_point.kind_of?(Task) @failed_task = failure_point end if !@failed_task && @failed_generator && @failed_generator.respond_to?(:task) @failed_task = failed_generator.task end if !@failed_task && !@failed_generator raise ArgumentError, "cannot deduce a task and/or a generator from #{failure_point}" end super("") end |
Instance Attribute Details
#failed_event ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
13 14 15 |
# File 'lib/roby/standard_errors.rb', line 13 def failed_event @failed_event end |
#failed_generator ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
13 14 15 |
# File 'lib/roby/standard_errors.rb', line 13 def failed_generator @failed_generator end |
#failed_task ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
13 14 15 |
# File 'lib/roby/standard_errors.rb', line 13 def failed_task @failed_task end |
#failure_point ⇒ Object (readonly)
The object describing the point of failure
10 11 12 |
# File 'lib/roby/standard_errors.rb', line 10 def failure_point @failure_point end |
Instance Method Details
#involved_plan_object?(obj) ⇒ Boolean
True if obj is involved in this error
51 52 53 54 55 56 |
# File 'lib/roby/standard_errors.rb', line 51 def involved_plan_object?(obj) obj.kind_of?(PlanObject) && (obj == failed_event || obj == failed_generator || obj == failed_task) end |
#pretty_print(pp) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/roby/standard_errors.rb', line 37 def pretty_print(pp) pp.text "#{self.class.name}" if !.empty? pp.text ": #{}" end pp.breakable failure_point.pretty_print(pp) if backtrace && !backtrace.empty? Roby.pretty_print_backtrace(pp, backtrace) end end |