Exception: Syskit::AmbiguousServiceSelection
Overview
Exception raised when a service is being selected by type, but multiple services are available within the component that match the requested type
Direct Known Subclasses
Instance Attribute Summary collapse
-
#candidates ⇒ Array<Models::BoundDataService>
readonly
The set of data services that matched the requested type.
-
#required_service ⇒ Model<DataService>
readonly
The model of data service we were looking for.
-
#task_model ⇒ Model<Component>
readonly
The component on which we were looking for a given service.
Instance Method Summary collapse
-
#initialize(task_model, required_service, candidates) ⇒ AmbiguousServiceSelection
constructor
A new instance of AmbiguousServiceSelection.
- #pretty_print(pp) ⇒ Object
Constructor Details
#initialize(task_model, required_service, candidates) ⇒ AmbiguousServiceSelection
Returns a new instance of AmbiguousServiceSelection
213 214 215 216 |
# File 'lib/syskit/exceptions.rb', line 213 def initialize(task_model, required_service, candidates) @task_model, @required_service, @candidates = task_model, required_service, candidates end |
Instance Attribute Details
#candidates ⇒ Array<Models::BoundDataService> (readonly)
Returns the set of data services that matched the requested type
211 212 213 |
# File 'lib/syskit/exceptions.rb', line 211 def candidates @candidates end |
#required_service ⇒ Model<DataService> (readonly)
Returns the model of data service we were looking for
208 209 210 |
# File 'lib/syskit/exceptions.rb', line 208 def required_service @required_service end |
#task_model ⇒ Model<Component> (readonly)
Returns the component on which we were looking for a given service
206 207 208 |
# File 'lib/syskit/exceptions.rb', line 206 def task_model @task_model end |
Instance Method Details
#pretty_print(pp) ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/syskit/exceptions.rb', line 218 def pretty_print(pp) pp.text "there is an ambiguity while looking for a service of type #{required_service} in #{task_model.short_name}" pp.breakable pp.text "candidates are:" pp.nest(2) do pp.breakable pp.seplist(candidates) do |service| pp.text(service.name || service.to_s) end end end |