astropy / astropy/astropy

Consider catching exceptions in io.ascii readers and raising as InconsistentTableError

Open
#3,346 2 comments 0 reactions 0 assignees View on GitHub
Effort-medium io.ascii Package-expert
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
74

Description

Currently in the guessing process there are four exceptions that are handled in a failed read attempt: `core.InconsistentTableError, ValueError, TypeError, AttributeError`. The last one was added in #3342 to fix a problem with tables that almost look like DAOphot.

A different way to approach this is to pro-actively catch expected parsing errors in the various readers and re-raise as `InconsistentTableError` or possibly subclasses there-of. This would have the benefit of forcing scrutiny of the various failure paths and then providing users with better feedback for what went wrong. This would be immediately beneficial in the no-guess case. It could also be useful for guessing since we might provide a mode to print out the exception message for each guess try. Currently this isn't that useful since the exceptions are not always something that the user can make sense of.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the io.ascii readers and the guessing process described in the issue, including the four exceptions currently handled for failed reads. Trace the parsing failure paths in each reader and determine which should be re-raised as InconsistentTableError or a subclass. Done means expected parsing failures provide clearer errors in no-guess mode while preserving the existing guessing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.