Exception: Roby::CodeError
- Inherits:
-
InternalTaskError
- Object
- RuntimeError
- ExceptionBase
- LocalizedError
- InternalTaskError
- Roby::CodeError
- 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, …
Direct Known Subclasses
CommandFailed, EmissionFailed, EventHandlerError, FailedExceptionHandler
Instance Attribute Summary
Attributes inherited from LocalizedError
#failed_event, #failed_generator, #failed_task, #failure_point
Attributes inherited from ExceptionBase
Class Method Summary collapse
-
.match ⇒ Queries::CodeErrorMatcher
Create a Queries::CodeErrorMatcher that matches this exception.
Instance Method Summary collapse
-
#error ⇒ Object
deprecated
Deprecated.
use #original_exception instead
-
#initialize(error, *args) ⇒ CodeError
constructor
Create a CodeError object from the given original exception object, and with the given failure point.
-
#original_exception ⇒ Object
The original exception object.
- #pretty_print(pp) ⇒ Object
Methods inherited from LocalizedError
#fatal?, #involved_plan_object?, #propagated?, #to_execution_exception, to_execution_exception_matcher
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(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
.match ⇒ Queries::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
#error ⇒ Object
use #original_exception instead
331 332 333 |
# File 'lib/roby/standard_errors.rb', line 331 def error original_exception end |
#original_exception ⇒ Object
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 |