Exception: Roby::LocalizedError
- Inherits:
-
ExceptionBase
- Object
- RuntimeError
- ExceptionBase
- Roby::LocalizedError
- Includes:
- DRoby::V5::LocalizedErrorDumper
- Defined in:
- lib/roby/standard_errors.rb,
lib/roby/droby/enable.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
ActionStateTransitionFailed, CommandRejected, Coordination::Models::Script::DeadInstruction, Coordination::Script::TimedOut, DRoby::V5::UntypedLocalizedError, EmissionRejected, EventCanceled, EventNotControlable, EventNotExecutable, EventPreconditionFailed, EventStructure::MissedDeadlineError, EventStructure::OccurenceConstraintViolation, EventStructure::TemporalConstraintViolation, FailedToStart, InternalTaskError, PlanningFailedError, QuarantinedTaskError, RelationFailedError, TaskEmergencyTermination, TaskNotExecutable, ToplevelTaskError, 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.
Attributes inherited from ExceptionBase
Class Method Summary collapse
-
.match ⇒ Queries::LocalizedErrorMatcher
Create a Queries::LocalizedErrorMatcher that matches this exception.
- .to_execution_exception_matcher ⇒ Queries::ExecutionExceptionMatcher
Instance Method Summary collapse
-
#fatal? ⇒ Boolean
If true, such an exception causes the execution engine to stop tasks in the hierarchy.
-
#initialize(failure_point) ⇒ LocalizedError
constructor
Create a LocalizedError object with the given failure point.
-
#involved_plan_object?(obj) ⇒ Boolean
True if
obj
is involved in this error. - #pretty_print(pp) ⇒ Object
-
#propagated? ⇒ Boolean
If true, such an exception will be propagated in the plan dependency structure.
- #to_execution_exception ⇒ Object
Methods included from DRoby::V5::LocalizedErrorDumper
Methods inherited from ExceptionBase
#each_original_exception, #report_exceptions_from
Methods included from DRoby::V5::ExceptionBaseDumper
Methods included from DRoby::V5::Builtins::ExceptionDumper
Constructor Details
#initialize(failure_point) ⇒ LocalizedError
Create a LocalizedError object with the given failure point
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/roby/standard_errors.rb', line 106 def initialize(failure_point) super() @failure_point = failure_point @failed_task, @failed_event, @failed_generator = nil 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 failed_event&.protect_all_sources end |
Instance Attribute Details
#failed_event ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
103 104 105 |
# File 'lib/roby/standard_errors.rb', line 103 def failed_event @failed_event end |
#failed_generator ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
103 104 105 |
# File 'lib/roby/standard_errors.rb', line 103 def failed_generator @failed_generator end |
#failed_task ⇒ Object (readonly)
The objects of the given categories which are related to #failure_point
103 104 105 |
# File 'lib/roby/standard_errors.rb', line 103 def failed_task @failed_task end |
#failure_point ⇒ Object (readonly)
The object describing the point of failure
100 101 102 |
# File 'lib/roby/standard_errors.rb', line 100 def failure_point @failure_point end |
Class Method Details
.match ⇒ Queries::LocalizedErrorMatcher
Create a Queries::LocalizedErrorMatcher that matches this exception
158 159 160 |
# File 'lib/roby/standard_errors.rb', line 158 def self.match Roby::Queries::LocalizedErrorMatcher.new.with_model(self) end |
.to_execution_exception_matcher ⇒ Queries::ExecutionExceptionMatcher
151 152 153 |
# File 'lib/roby/standard_errors.rb', line 151 def self.to_execution_exception_matcher Roby::Queries::ExecutionExceptionMatcher.new.with_model(self) end |
Instance Method Details
#fatal? ⇒ Boolean
If true, such an exception causes the execution engine to stop tasks in the hierarchy. Otherwise, it only causes notification(s).
86 87 88 |
# File 'lib/roby/standard_errors.rb', line 86 def fatal? true end |
#involved_plan_object?(obj) ⇒ Boolean
True if obj
is involved in this error
145 146 147 148 |
# File 'lib/roby/standard_errors.rb', line 145 def involved_plan_object?(obj) obj.kind_of?(PlanObject) && [failed_event, failed_generator, failed_task].include?(obj) end |
#pretty_print(pp) ⇒ Object
135 136 137 138 139 140 141 142 |
# File 'lib/roby/standard_errors.rb', line 135 def pretty_print(pp) pp.text self.class.name.to_s unless .empty? pp.text ": #{}" end pp.breakable failure_point.pretty_print(pp) end |
#propagated? ⇒ Boolean
If true, such an exception will be propagated in the plan dependency structure. Otherwise, it’s directly reported to the plan itself (which can choose to handle it).
This is usually set to false for exceptions that report global information about the plan, such as e.g. MissionFailedError
96 97 98 |
# File 'lib/roby/standard_errors.rb', line 96 def propagated? true end |
#to_execution_exception ⇒ Object
131 132 133 |
# File 'lib/roby/standard_errors.rb', line 131 def to_execution_exception ExecutionException.new(self) end |