Exception: Syskit::UnknownServiceName

Inherits:
SpecError show all
Defined in:
lib/syskit/exceptions.rb

Overview

Exception raised when a service of a given name is required but none can be found on a particular task context model

See Also:

  • AmbiguousServiceSelection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component_model, service_name) ⇒ UnknownServiceName

Returns a new instance of UnknownServiceName



163
164
165
# File 'lib/syskit/exceptions.rb', line 163

def initialize(component_model, service_name)
    @component_model, @service_name = component_model, service_name
end

Instance Attribute Details

#component_modelModel<Component> (readonly)

Returns the component on which we were looking for a given service

Returns:

  • (Model<Component>)

    the component on which we were looking for a given service



159
160
161
# File 'lib/syskit/exceptions.rb', line 159

def component_model
  @component_model
end

#service_nameString (readonly)

Returns the service name

Returns:

  • (String)

    the service name



161
162
163
# File 'lib/syskit/exceptions.rb', line 161

def service_name
  @service_name
end

Instance Method Details

#pretty_print(pp) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/syskit/exceptions.rb', line 167

def pretty_print(pp)
    pp.text "cannot find service #{service_name} in #{component_model.short_name}"
    pp.text "the services of #{component_model.short_name} are:"
    pp.nest(2) do
        pp.breakable
        pp.seplist(component_model.each_data_service.to_a) do |srv|
            _, srv = *srv
            pp.text "#{srv.full_name}: #{srv.model.short_name}"
        end
    end
end