class Roby::LocalizedError

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.

Attributes

failed_event[R]

The objects of the given categories which are related to failure_point

failed_generator[R]

The objects of the given categories which are related to failure_point

failed_task[R]

The objects of the given categories which are related to failure_point

failure_point[R]

The object describing the point of failure

Public Class Methods

match() click to toggle source

Create a {Queries::LocalizedErrorMatcher} that matches this exception

@return [Queries::LocalizedErrorMatcher]

# File lib/roby/standard_errors.rb, line 150
def self.match
    Roby::Queries::LocalizedErrorMatcher.new.with_model(self)
end
new(failure_point) click to toggle source

Create a LocalizedError object with the given failure point

Calls superclass method Roby::ExceptionBase::new
# File lib/roby/standard_errors.rb, line 95
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

    if failed_event
        failed_event.protect_all_sources
    end
end
to_execution_exception_matcher() click to toggle source

@return [Queries::ExecutionExceptionMatcher]

# File lib/roby/standard_errors.rb, line 143
def self.to_execution_exception_matcher
    Roby::Queries::ExecutionExceptionMatcher.new.with_model(self)
end

Public Instance Methods

fatal?() click to toggle source

If true, such an exception causes the execution engine to stop tasks in the hierarchy. Otherwise, it only causes notification(s).

# File lib/roby/standard_errors.rb, line 80
def fatal?; true end
involved_plan_object?(obj) click to toggle source

True if obj is involved in this error

# File lib/roby/standard_errors.rb, line 135
def involved_plan_object?(obj)
    obj.kind_of?(PlanObject) && 
        (obj == failed_event ||
         obj == failed_generator ||
         obj == failed_task)
end
pretty_print(pp) click to toggle source
# File lib/roby/standard_errors.rb, line 125
def pretty_print(pp)
    pp.text "#{self.class.name}"
    if !message.empty?
        pp.text ": #{message}"
    end
    pp.breakable
    failure_point.pretty_print(pp)
end
propagated?() click to toggle source

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

# File lib/roby/standard_errors.rb, line 87
def propagated?; true end
to_execution_exception() click to toggle source
# File lib/roby/standard_errors.rb, line 121
def to_execution_exception
    ExecutionException.new(self)
end