Skip to content

Conversation

Copy link

Copilot AI commented Dec 12, 2025

Addressed review feedback requesting specific exception types instead of bare except: clauses in exptool/analysis/pattern.py.

Changes:

  • Line 302: except (FileNotFoundError, IOError, ValueError): - catches file reading/parsing errors when loading bar files
  • Line 562: except IndexError: - handles missing third column in data files
  • Line 662: except TypeError: - handles scalar vs array input for time parameter

Before:

try:
    indx_barpos = np.zeros([len(time)])
    for indx, timeval in enumerate(time):
        # ...
except:  # Unclear what exceptions are expected
    # Handle scalar time value

After:

try:
    indx_barpos = np.zeros([len(time)])
    for indx, timeval in enumerate(time):
        # ...
except TypeError:  # Explicitly handle scalar input
    # Handle scalar time value

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 12, 2025 10:27
Co-authored-by: michael-petersen <19195541+michael-petersen@users.noreply.github.com>
Co-authored-by: michael-petersen <19195541+michael-petersen@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from review on Draft HDF5 converter PR Specify exception types in bare except clauses Dec 12, 2025
@michael-petersen
Copy link
Owner

I need to get better about this in general!

@michael-petersen michael-petersen marked this pull request as ready for review December 12, 2025 11:56
@michael-petersen michael-petersen merged commit 9967777 into hdf5 Dec 12, 2025
@michael-petersen michael-petersen deleted the copilot/sub-pr-29-again branch December 12, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants