Class: Syskit::PortNotFound

Inherits:
Roby::LocalizedError
  • Object
show all
Defined in:
lib/syskit/runtime/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task, name, kind) ⇒ PortNotFound

Returns a new instance of PortNotFound



6
7
8
9
10
# File 'lib/syskit/runtime/exceptions.rb', line 6

def initialize(task, name, kind)
    @port_name = name
    @port_kind = kind
    super(task)
end

Instance Attribute Details

#port_kindObject (readonly)

Returns the value of attribute port_kind



4
5
6
# File 'lib/syskit/runtime/exceptions.rb', line 4

def port_kind
  @port_kind
end

#port_nameObject (readonly)

Returns the value of attribute port_name



3
4
5
# File 'lib/syskit/runtime/exceptions.rb', line 3

def port_name
  @port_name
end

Instance Method Details

#pretty_print(pp) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/syskit/runtime/exceptions.rb', line 12

def pretty_print(pp)
    pp.text "#{self.class}: #{failed_task} has connections but there are missing ports on the actual RTT task"
    pp.nest(2) do
        pp.breakable
        pp.text "the RTT task #{failed_task.orocos_name} of type #{failed_task.model.short_name} was expected to have a port called #{port_name}, but does not."
        pp.breakable

        dynamic_model, static_model =
            failed_task.model, failed_task.concrete_model

        # Might have been a wrong configure() implementation. Check.
        if dynamic_model &&
            dynamic_model.send("find_#{port_kind}_port", port_name) &&
            !static_model.send("find_#{port_kind}_port", port_name)

            pp.text "it is a dynamic port that should have been created by #{static_model.short_name}#configure"
        elsif static_model.send("find_#{port_kind}_port", port_name)
            pp.text "it is a static port that should be there on every task of type #{static_model.short_name}"
        end
    end
end