module Roby::ExceptionHandlingObject
This module is to be included in all objects that are able to handle exception. These objects should define
#each_exception_handler { |matchers, handler| ... }
See Task::on_exception and Task#on_exception
Public Instance Methods
add_error(error, propagate_through: nil)
click to toggle source
# File lib/roby/exceptions.rb, line 176 def add_error(error, propagate_through: nil) execution_engine.add_error(error, propagate_through: propagate_through) end
handle_exception(exception_object)
click to toggle source
Calls the exception handlers defined in this task for exception_object.exception
Returns true if the exception has been handled, false otherwise
# File lib/roby/exceptions.rb, line 182 def handle_exception(exception_object) each_exception_handler do |matcher, handler| if exception_object.exception.kind_of?(FailedExceptionHandler) # Do not handle a failed exception handler by itself next if exception_object.exception.handler == handler end if matcher === exception_object catch(:next_exception_handler) do begin handler.call(self, exception_object) return true rescue Exception => e if !kind_of?(PlanObject) execution_engine.add_framework_error(e, 'global exception handling') else add_error(FailedExceptionHandler.new(e, self, exception_object, handler)) end end end end end return false end
pass_exception()
click to toggle source
To be used in exception handlers themselves. Passes the exception to the next matching exception handler
# File lib/roby/exceptions.rb, line 172 def pass_exception throw :next_exception_handler end