ion-python icon indicating copy to clipboard operation
ion-python copied to clipboard

Error Information lacking for Numeric Overflow

Open rmarrowstone opened this issue 2 years ago • 0 comments

When loading a large decimal with the c-extension (which has a limited decimal size), if the decimal is too large the error thrown is not helpful:

>>> simpleion.loads('49.89999999999999857891452847979962825775146484375')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/calhounr/ion-python-ws/ion-python/amazon/ion/simpleion.py", line 478, in loads
    return load(ion_buffer, catalog=catalog, single_value=single_value, encoding=encoding, cls=cls,
  File "/Users/calhounr/ion-python-ws/ion-python/amazon/ion/simpleion.py", line 532, in load
    return load_extension(fp, parse_eagerly=parse_eagerly, single_value=single_value)
  File "/Users/calhounr/ion-python-ws/ion-python/amazon/ion/simpleion.py", line 496, in load_extension
    value = next(iterator)
amazon.ion.exceptions.IonException: IERR_NUMERIC_OVERFLOW

Some context, such as line/char numbers, value before the failure, something, would be helpful. It doesn't even indicate if it is an Int or Decimal that overflows.

This may be a broader issue, but this is the only case I have observed so far.

rmarrowstone avatar Dec 09 '22 18:12 rmarrowstone