Skip to content

Raise an exception if add_object fails to add object to SHOP.

Kent Fagerjord requested to merge feat/error-on-add_model into main

Raise an exception if there is a problem adding objects to SHOP.

# Create a session without a valid license.
shop = ShopSession()
rsv1 = shop.model.reservoir.add_object('Reservoir1') # Ok
dischg1 = shop.model.discharge_group.add_object('Dischg') # Exception will be raised

A similar error will occur if adding invalid objects through YAML or JSON if using SHOP 15.5 or later.

Merge request reports