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
25 stars 10 forks source link

Harden renderer against list index out of range during substitution #4

Closed derekgengenbacher-wf closed 2 years ago

derekgengenbacher-wf commented 2 years ago

Description:

We have noticed that when the xule in the renderer templates is incorrect it can cause the following error:

File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", in render_report
    template_number, fact_number, processed_facts, processed_footnotes)
  File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", in substituteTemplate
    context_ids, unit_ids, footnotes, template_number, fact_number, processed_facts)
  File "/usr/local/lib/python3.9/site-packages/ferc_renderer/render.py", in substitute_rule
    fact_object_index = use_refs[rule_focus_index]['objectId']

In order to improve the stability of the renderer in these cases, this improvement allows the renderer to succeed while adding a log to the log.txt generated by the renderer and renders an Error: Rule XX in the viewer so that it is easy to track down what section and rule are causing an issue.

@davidtauriello

derekgengenbacher-wf commented 2 years ago

This was addressed by updating rules.