pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

When user pragmas an unsupported type, a nondescript KeyError is raised #131

Closed klauer closed 4 years ago

klauer commented 4 years ago

https://github.com/slaclab/pytmc/blob/1ce15bec4ec4cef15467f8b6368dacdbef61c315/pytmc/record.py#L109

Traceback (most recent call last):
  File "/usr/local/bin/pytmc", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/pytmc.py", line 83, in main
    func(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/debug.py", line 291, in main
    interface = create_debug_gui(tmc_file, dbd)
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/debug.py", line 263, in create_debug_gui
    return TmcSummary(tmc, dbd)
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/debug.py", line 95, in __init__
    for record in process(tmc, allow_errors=True):
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/db.py", line 104, in process
    for symbol in find_pytmc_symbols(tmc)
  File "/usr/local/lib/python3.7/site-packages/pytmc/bin/db.py", line 105, in <listcomp>
    for record in record_packages_from_symbol(symbol)
  File "/usr/local/lib/python3.7/site-packages/pytmc/pragmas.py", line 318, in record_packages_from_symbol
    yield RecordPackage.from_chain(symbol.module.ads_port, chain=chain)
  File "/usr/local/lib/python3.7/site-packages/pytmc/record.py", line 109, in from_chain
    spec = data_types[data_type.name]
KeyError: 'TIME'

KeyError should be caught here and re-raised with something useful indicating the chain.