Exception: Roby::CodeError

Inherits:
LocalizedError show all
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 collapse

Attributes inherited from LocalizedError

#failed_event, #failed_generator, #failed_task, #failure_point

Instance Method Summary collapse

Methods inherited from LocalizedError

#involved_plan_object?

Constructor Details

#initialize(error, *args) ⇒ CodeError

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



92
93
94
95
96
97
98
# File 'lib/roby/standard_errors.rb', line 92

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

Instance Attribute Details

#errorObject (readonly)

The original exception object



89
90
91
# File 'lib/roby/standard_errors.rb', line 89

def error
  @error
end

Instance Method Details

#pretty_print(pp) ⇒ Object

:nodoc:



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/roby/standard_errors.rb', line 100

def pretty_print(pp) # :nodoc:
    if error
               pp.text "#{self.class.name}: user code raised an exception "
               failure_point.pretty_print(pp)
               pp.breakable
               pp.breakable
               error.pretty_print(pp)
    else
	super
    end
end