miranov25 / RootInteractive

4 stars 12 forks source link

Better Error handling in cases of invalid widget specification #332

Closed miranov25 closed 10 months ago

miranov25 commented 10 months ago

The code below with an invalid widget type (spinnerrange instead of spinnerrange) is not caught. The code is only failing with stack trace which is non meaningful.

widgetParams+=[
    ["multiSelect", ["run"],{"name":"run"}],
    ["spinnerrange", ["dTime"],{"name":"dTime"}],
    ["spinnerRange", ["qPt"],{"name":"qPt"}],
    ["spinnerRange", ["tgl"],{"name":"tgl"}],
    ["spinnerRange", ["dcasR"],{"name":"dcasR"}],
    ["spinnerRange", ["dcasZ"],{"name":"dcasZ"}],
]

TODO:

Current stack trace in case of syntax error above

> /u/miranov/github/RootInteractive/RootInteractive/InteractiveDrawing/bokeh/bokehTools.py(803)bokehDrawArray()
    801         for axis_index, axis_name  in enumerate(BOKEH_DRAW_ARRAY_VAR_NAMES):
    802             if axis_index < nvars:
--> 803                 variablesLocal[axis_index] = variables[axis_index].copy()
    804             elif axis_name in optionLocal:
    805                 variablesLocal[axis_index] = optionLocal[axis_name]

ipdb> print(variablesLocal)
[None, None, None, None, None, None, None, None]
ipdb> print(variables)
['spinnerrange', ['dTime'], {'name': 'dTime'}]