Skip to content

Replace bare except clause with specific exception types in info_image_updates_available#117

Closed
Copilot wants to merge 2 commits intoissue1512from
copilot/sub-pr-113-yet-again
Closed

Replace bare except clause with specific exception types in info_image_updates_available#117
Copilot wants to merge 2 commits intoissue1512from
copilot/sub-pr-113-yet-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 11, 2026

Addresses review feedback on PR #113 regarding a bare except: clause with no explanatory comment at line 693 in src/nethsec/inventory/__init__.py.

Changes

  • Replace bare except: with specific exception types: subprocess.SubprocessError, json.JSONDecodeError, OSError
  • Add explanatory comment describing why exceptions are caught and silently handled
# Before
except:
    pass

# After
except (subprocess.SubprocessError, json.JSONDecodeError, OSError):
    # Return False if the update check fails due to subprocess errors,
    # invalid JSON response, or file system issues (e.g., missing command)
    pass

The function maintains its safe default behavior of returning False when update checks fail, while making exception handling explicit and maintainable.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… comment

Co-authored-by: gsanchietti <804596+gsanchietti@users.noreply.github.com>
Copilot AI changed the title [WIP] Add extra info to inventory based on feedback Replace bare except clause with specific exception types in info_image_updates_available Feb 11, 2026
Copilot AI requested a review from gsanchietti February 11, 2026 10:26
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