ixmp
ixmp copied to clipboard
IxException not handled correctly in Scenario.remove_solution()
When trying to modify a scenarios with a solution, it throws an error saying:
at.ac.iiasa.ixmp.exceptions.IxExceptionPyRaisable: at.ac.iiasa.ixmp.exceptions.IxException: This Scenario has elements in a variable or equation! Use 'removeSolution()' or clone(False)'before editing!
removeSolution()
is deprecated. Actual name is remove_sol()
.
removeSolution()
is the correct method name in the Java code, ixmp_source:
https://github.com/iiasa/ixmp_source/blob/1000dfcca661377666b32a4a0783a8f99309203b/src/main/java/at/ac/iiasa/ixmp/objects/Scenario.java#L1291
The bug here is that ixmp is letting the IxException raised by ixmp_source pass through to the user directly. Instead, ixmp should catch this exception and re-raise it with the proper message.
@DIUANA in #256 reported another instance, in Scenario.init_set()
, that can be fixed at the same time as this one.