Exception: Roby::CodeError

Inherits:
InternalTaskError show all
Includes:
UserExceptionWrapper
Defined in:
lib/roby/standard_errors.rb

Overview

Raised when a user-provided code block (i.e. a code block which is outside of Roby’s plan management algorithms) has raised. This includes: event commands, event handlers, task polling blocks, …

Instance Attribute Summary

Attributes inherited from LocalizedError

#failed_event, #failed_generator, #failed_task, #failure_point

Attributes inherited from ExceptionBase

#original_exceptions

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LocalizedError

#fatal?, #involved_plan_object?, #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(error, *args) ⇒ CodeError

Create a CodeError object from the given original exception object, and with the given failure point



337
338
339
340
341
342
343
344
# File 'lib/roby/standard_errors.rb', line 337

def initialize(error, *args)
    if error && !error.kind_of?(Exception)
        raise TypeError, "#{error} should be an exception"
    end

    super(*args)
    report_exceptions_from(error)
end

Class Method Details

.matchQueries::CodeErrorMatcher

Create a Queries::CodeErrorMatcher that matches this exception



354
355
356
# File 'lib/roby/standard_errors.rb', line 354

def self.match
    Roby::Queries::CodeErrorMatcher.new.with_model(self)
end

Instance Method Details

#errorObject

Deprecated.

use #original_exception instead



331
332
333
# File 'lib/roby/standard_errors.rb', line 331

def error
    original_exception
end

#original_exceptionObject

The original exception object



326
327
328
# File 'lib/roby/standard_errors.rb', line 326

def original_exception
    original_exceptions.first
end

#pretty_print(pp) ⇒ Object



346
347
348
349
# File 'lib/roby/standard_errors.rb', line 346

def pretty_print(pp)
    pp.text "#{self.class.name}: user code raised an exception "
    failure_point.pretty_print(pp)
end