xbrlus / xule

An open-source XBRL processor for business rules, rendering and custom data reporting. See https://xbrl.us/xule for documentation and https://xbrl.us/xule-editor for a VS Code syntax highlighter.
Apache License 2.0
24 stars 10 forks source link

Wrap transformation in try/except block #1

Closed derekgengenbacher-wf closed 2 years ago

derekgengenbacher-wf commented 2 years ago

Description

If an invalid date with a {http://www.xbrl.org/inlineXBRL/transformation/2010-04-20}dateslashus transformation is run through the Renderer, it produces the following error:

File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", line 881, in substitute_rule
    fact_number)
  File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", line 2445, in format_fact
    scale)
  File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", line 2671, in format_dateslahus
    return model_fact.xValue.strftime('%m/%d/%Y')
AttributeError: 'str' object has no attribute 'strftime'

This error only appears to be affecting FERC v1.5 at the moment. But to be on the safe side we should go ahead and guard this transformation like some of the other transformations. By raising a FERCRenderException it allows this except to render the supplied value, but adds a log in the log.txt that is included in renderer zip.

@davidtauriello

davidtauriello commented 2 years ago

see d4a89e1