You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Java code in iiasa/ixmp_source that underlies JDBCBackend raises a variety of exceptions.
JDBCBackend itself has to catch, inspect, and re-raise these in order to give standard Python exceptions—for instance, any add_*() call that gives an invalid name for a Scenario item (set, parameter, etc.) should raise a KeyError; if the user gives malformed data, instead a ValueError, etc.
# NB Much of the code of this backend is in Java, in the iiasa/ixmp_source
# Github repository.
#
# Among other abstractions, this backend:
#
# - Handles any conversion between Java and Python types that is not
# done automatically by JPype.
# - Catches Java exceptions such as ixmp.exceptions.IxException, and
# re-raises them as appropriate Python exceptions.
As noted by @zikolach at #289 (comment), this is unwieldy. It would be better if ixmp_source was adjusted to raise Pythonic exceptions that could be more or less passed through, without the need for JDBCBackend to interpret the messages to determine the correct class.
This also requires updating the spec in backend.base.Backend to specify what exceptions should be raised.
The text was updated successfully, but these errors were encountered:
The Java code in iiasa/ixmp_source that underlies JDBCBackend raises a variety of exceptions.
JDBCBackend itself has to catch, inspect, and re-raise these in order to give standard Python exceptions—for instance, any
add_*()
call that gives an invalid name for a Scenario item (set, parameter, etc.) should raise a KeyError; if the user gives malformed data, instead a ValueError, etc.ixmp/ixmp/backend/jdbc.py
Lines 146 to 154 in 3e16ec8
As noted by @zikolach at #289 (comment), this is unwieldy. It would be better if ixmp_source was adjusted to raise Pythonic exceptions that could be more or less passed through, without the need for JDBCBackend to interpret the messages to determine the correct class.
This also requires updating the spec in backend.base.Backend to specify what exceptions should be raised.
The text was updated successfully, but these errors were encountered: