Exception: Syskit::InvalidCompositionChildSelection

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

Overview

Exception raised when the user provided a composition child selection that is not compatible with the child definition

Instance Attribute Summary collapse

Attributes inherited from InstanciationError

#instanciation_chain

Instance Method Summary collapse

Constructor Details

#initialize(composition_model, child_name, selected_model, required_models) ⇒ InvalidCompositionChildSelection

Returns a new instance of InvalidCompositionChildSelection



618
619
620
621
622
# File 'lib/syskit/exceptions.rb', line 618

def initialize(composition_model, child_name, selected_model, required_models)
    super()
    @composition_model, @child_name, @selected_model, @required_models =
        composition_model, child_name, selected_model, required_models
end

Instance Attribute Details

#child_nameObject (readonly)

The child name for which the selection is invalid



612
613
614
# File 'lib/syskit/exceptions.rb', line 612

def child_name
  @child_name
end

#composition_modelObject (readonly)

The composition model



610
611
612
# File 'lib/syskit/exceptions.rb', line 610

def composition_model
  @composition_model
end

#required_modelsObject (readonly)

The model required by the composition for child_name



616
617
618
# File 'lib/syskit/exceptions.rb', line 616

def required_models
  @required_models
end

#selected_modelObject (readonly)

The model selected by the user



614
615
616
# File 'lib/syskit/exceptions.rb', line 614

def selected_model
  @selected_model
end

Instance Method Details

#pretty_print(pp) ⇒ Object



624
625
626
627
628
629
630
631
632
633
634
# File 'lib/syskit/exceptions.rb', line 624

def pretty_print(pp)
    pp.text "cannot use #{selected_model.short_name} for the child #{child_name} of #{composition_model.short_name}"
    pp.breakable
    pp.text "it does not provide the required models"
    pp.nest(2) do
        pp.breakable
        pp.seplist(required_models) do |m|
            pp.text m.short_name
        end
    end
end