ixmp icon indicating copy to clipboard operation
ixmp copied to clipboard

IxException not handled correctly in Scenario.remove_solution()

Open alexkoberle opened this issue 6 years ago • 2 comments

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().

alexkoberle avatar Sep 05 '18 15:09 alexkoberle

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.

khaeru avatar Aug 09 '19 14:08 khaeru

@DIUANA in #256 reported another instance, in Scenario.init_set(), that can be fixed at the same time as this one.

khaeru avatar Jan 24 '20 07:01 khaeru