Open Anushka-Pote opened 2 weeks ago
Thank you @Anushka-Pote for bringing up these important points! Your attention to detail and focus on handling borderline scenarios are truly commendable. Enhancing error handling and data validation will definitely make the application more robust and user-friendly. I appreciate you highlighting these areas and we look forward to you valuable contributions.
@jency1 please assign me this issue as i wanted to work on this issue
Description:
Enhance the robustness of the Python files in the project by implementing comprehensive error handling and data validation mechanisms. This will ensure the application can handle unexpected scenarios gracefully and provide meaningful feedback to the user.
Tasks:
-Error Handling: Implement try-except blocks around database connection and query execution code to handle database-related errors gracefully. Provide user-friendly error messages using messagebox.showerror() to inform users about connection issues or query failures. Ensure that all functions that interact with the database (e.g., view_data, check_credentials, fetch_data, etc.) include error handling.
-Data Validation: Validate user input in the check_credentials function to ensure that the username and password fields are not empty before proceeding with the database query. In the fetch_data function, check if the u_id provided is valid (e.g., a positive integer) before executing the query. Ensure that any data processed from the database (e.g., dates, monetary values) are in the expected format. If not, return an appropriate error message. Implement checks in the decrypt function to handle unexpected input lengths or formats.
-Unit Testing: Write unit tests for the error handling and data validation logic to ensure that the implemented features work correctly. Include test cases for both valid and invalid inputs to confirm that errors are handled appropriately. Acceptance Criteria: All database operations have robust error handling with user-friendly messages. User input is validated before processing, and appropriate error messages are provided for invalid input. Unit tests are implemented and successfully cover various scenarios.