Skip to content

Improve error message when cannot find a named HDU in a fits file #78

@gsleap

Description

@gsleap

Example from @d3v-null:

03_mwalib.py test_files/1120082744/1120082744_DipAmps.metafits   
Traceback (most recent call last):
  File "/demo/03_mwalib.py", line 62, in <module>
    main()
  File "/demo/03_mwalib.py", line 48, in main
    ctx = MetafitsContext(metafits)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
mwalib.MwalibError: src/metafits_context/mod.rs:682
test_files/1120082744/1120082744_DipAmps.metafits HDU 9999: Fits error: FitsError { status: 301, message: "illegal HDU number" }

In this case the actual error was that the TILEDATA hdu was present but did not have:
EXTNAME = 'TILEDATA' / extension name

A better error message would have saved some troubleshooting time and been clearer- e.g.:

Cannot locate 'TILEDATA' HDU in FITS file: xxxxx.fits

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions