fix(ConnectedDeviceInformation): add database query error handling#1398
Open
Tokenzrey wants to merge 1 commit intoabrignoni:mainfrom
Open
fix(ConnectedDeviceInformation): add database query error handling#1398Tokenzrey wants to merge 1 commit intoabrignoni:mainfrom
Tokenzrey wants to merge 1 commit intoabrignoni:mainfrom
Conversation
Collaborator
|
@Tokenzrey if you're using logfunc function throughout the script why not just import once instead of 3 times? |
Collaborator
|
The exceptions are too general and will override basic exceptions, and this will cause lint errors. The duplicate imports are unnecessary and will als cause lint errors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a critical bug in ConnectedDeviceInformation.py where the parser would crash when encountering invalid, corrupt, or non-SQLite files that matched the
healthdb*.sqlitefilename pattern.Previously, the script assumed 100% file integrity. If
sqlite3raised aDatabaseError(e.g., "file is not a database"), the exception was unhandled, leading to a complete failure of the artifact extraction. This update implements defensive programming to handle these scenarios gracefully.Changes
try-exceptblocks aroundget_sqlite_db_records()calls in:connected_device_info_device_historyconnected_device_info_consolidated_connected_device_historyconnected_device_information_current_device_infologfunc, anddb_recordsis set to an empty list. This allows the function to return a valid report structure (with zero records) instead of crashing.healthdbfiles and preserves the stability of the extraction process.Verification & Testing
I have created a comprehensive test suite (test_connected_device_fix.py) to verify the fix and ensure no regressions.
DatabaseErroris properly identified.Test Output Summary:
Checklist