Exception: Roby::CodeError

Inherits:
LocalizedError 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



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

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



287
288
289
# File 'lib/roby/standard_errors.rb', line 287

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

Instance Method Details

#errorObject

Deprecated.

use #original_exception instead



268
# File 'lib/roby/standard_errors.rb', line 268

def error; original_exception end

#original_exceptionObject

The original exception object



266
# File 'lib/roby/standard_errors.rb', line 266

def original_exception; original_exceptions.first end

#pretty_print(pp) ⇒ Object



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

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