Exception: Roby::Planning::NotFound

Inherits:
PlanModelError show all
Defined in:
lib/roby/planning/model.rb

Overview

Raised a method has found no valid development

Instance Attribute Summary collapse

Attributes inherited from PlanModelError

#planner

Instance Method Summary collapse

Constructor Details

#initialize(planner, errors) ⇒ NotFound

Returns a new instance of NotFound.



33
34
35
36
# File 'lib/roby/planning/model.rb', line 33

def initialize(planner, errors)
    @errors = errors
    super(planner)
end

Instance Attribute Details

#errorsObject (readonly)

A method => error hash of all the method that have been tried. error can either be a NotFound exception or another exception



31
32
33
# File 'lib/roby/planning/model.rb', line 31

def errors
  @errors
end

#method_nameObject

The name of the method which has failed



25
26
27
# File 'lib/roby/planning/model.rb', line 25

def method_name
  @method_name
end

#method_optionsObject

The planning options



27
28
29
# File 'lib/roby/planning/model.rb', line 27

def method_options
  @method_options
end

Instance Method Details

#full_messageObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/roby/planning/model.rb', line 54

def full_message
		msg = message
		first, *rem = *Roby.filter_backtrace(backtrace)

		full = "#{first}: #{msg}\n   from #{rem.join("\n    from ")}"
		errors.each do |m, error|
 first     = error.backtrace.first
 full << "\n#{first} #{m} failed because of #{error.full_message}"
		end
		full
end

#messageObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/roby/planning/model.rb', line 38

def message
		if errors.empty?
 "no candidate for #{method_name}(#{method_options})"
		else
 msg = "cannot develop a #{method_name}(#{method_options}) method"
 first, *rem = *Roby.filter_backtrace(backtrace)

 full = "#{first}: #{msg}\n   from #{rem.join("\n  from ")}"
 errors.each do |m, error|
			first, *rem = *Roby.filter_backtrace(error.backtrace)
			full << "\n#{first}: #{m} failed with #{error.message}\n  from #{rem.join("\n  from ")}"
 end
 full
		end
end