Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Error Handling for Missing Columns in Excel Input #236

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

vinayakjeet
Copy link

#46

Problem Description

When the "data sources" tab in the provided Excel files is missing a column, such as column G in older versions of the spreadsheet, the script encounters an unhandled exception and crashes. This results in an opaque error message that does not clearly indicate the cause of the problem, leading to potential confusion and making troubleshooting difficult.

Proposed Solution

To address this issue, it is suggested to wrap the section of the code that accesses potentially missing columns in a try-except block. This block should catch IndexError exceptions and log a warning that clearly identifies the missing column and provides guidance or suggestions for resolving the issue. The script should then continue to execute, allowing for the processing of any additional data that does not depend on the missing columns.

Expected Benefits

  • Improved Resilience: By catching and handling IndexError exceptions, the script will no longer crash when encountering missing columns, improving its overall resilience.
  • Clearer Error Reporting: The logging of specific warnings when columns are missing will make troubleshooting more straightforward, enhancing the user experience.
  • Enhanced Script Usability: Allowing the script to continue execution after encountering a missing column ensures that users can still obtain partial results from their input files, improving the script's usability in less-than-ideal scenarios.

Additional Notes

Implementing this solution does not prevent the issue of missing columns but provides a more graceful handling mechanism that benefits users by improving error transparency and script robustness.

Closes #46

Signed-off-by: Vinayakjeet Singh Karki <139736674+vinayakjeet@users.noreply.github.com>
Signed-off-by: Vinayakjeet Singh Karki <139736674+vinayakjeet@users.noreply.github.com>
Copy link
Contributor

@jakebeal jakebeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request mixed in the described change with a number of other changes in the helper_functions.py file. There are a number of failing tests, likely caused by these other changes.

There is also not currently a new test added to demonstrate that the exception is generated and caught as intended.

Can you please address these issues in this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opaque error when data sources is missing a column
2 participants