Exception: Roby::QuarantinedTaskError

Inherits:
LocalizedError show all
Defined in:
lib/roby/standard_errors.rb

Overview

Exception raised when a quarantined task is in use by other parts of the plan

Quarantines are used to indicate a failure of the framework to control a task. The most common case is a failure to stop the task.

See Also:

Instance Attribute Summary collapse

Attributes inherited from LocalizedError

#failed_event, #failed_generator, #failed_task, #failure_point

Attributes inherited from ExceptionBase

#original_exceptions

Instance Method Summary collapse

Methods inherited from LocalizedError

#fatal?, #involved_plan_object?, match, #propagated?, #to_execution_exception, to_execution_exception_matcher

Methods included from DRoby::V5::LocalizedErrorDumper

#droby_dump

Methods inherited from ExceptionBase

#each_original_exception, #report_exceptions_from

Methods included from DRoby::V5::ExceptionBaseDumper

#droby_dump

Methods included from DRoby::V5::Builtins::ExceptionDumper

#droby_dump

Constructor Details

#initialize(task) ⇒ QuarantinedTaskError

Returns a new instance of QuarantinedTaskError.



261
262
263
264
265
266
# File 'lib/roby/standard_errors.rb', line 261

def initialize(task)
    super(task)

    @reason = task.quarantine_reason
    report_exceptions_from(reason)
end

Instance Attribute Details

#reasonString, Exception (readonly)

Returns a reason for the quarantine, either as a plain message, or as the exception object that caused it. In the latter case, the exception object will be registered as one of the error’s ExceptionBase#original_exceptions.

Returns:

  • (String, Exception)

    a reason for the quarantine, either as a plain message, or as the exception object that caused it. In the latter case, the exception object will be registered as one of the error’s ExceptionBase#original_exceptions



259
260
261
# File 'lib/roby/standard_errors.rb', line 259

def reason
  @reason
end

Instance Method Details

#messageObject



268
269
270
271
272
273
274
275
276
# File 'lib/roby/standard_errors.rb', line 268

def message
    if @reason.respond_to?(:to_str)
        @reason
    elsif original_exceptions.include?(reason)
        super
    else
        PP.pp(reason, +"")
    end
end

#pretty_print(pp) ⇒ Object



278
279
280
281
282
283
# File 'lib/roby/standard_errors.rb', line 278

def pretty_print(pp)
    pp.text "The following task has been put in quarantine"
    pp.breakable

    super
end