Skip to content

refactor(update): isolate version comparison logic - #768

Merged
darbyjack merged 1 commit into
masterfrom
refractor/update-checker
Jun 26, 2026
Merged

refactor(update): isolate version comparison logic#768
darbyjack merged 1 commit into
masterfrom
refractor/update-checker

Conversation

@darbyjack

Copy link
Copy Markdown
Member

This pull request refactors and improves the UpdateChecker class, making the update-checking process more robust, modular, and easier to maintain. The changes include improved error handling, code modularization, and enhanced logging for update checks.

Refactoring and modularization:

  • Refactored the version comparison logic by extracting it into a new compareDecimalVersions static method, and similarly, moved the logic for reading the newest version from the JSON response into a new readNewestVersion method. This makes the code easier to read and maintain. [1] [2]

Error handling and robustness:

  • Improved error handling in requestUpdateCheck() by checking HTTP response codes before attempting to parse the response, handling more specific exceptions, and ensuring the HTTP connection is always closed in a finally block.
  • Enhanced logging in runCheck() to provide clearer warning messages when update checks fail, including logging exceptions if present.

Code quality improvements:

  • Updated imports and minor documentation (e.g., typo fix from "preferrably" to "preferably") for better clarity and correctness. [1] [2]

@darbyjack
darbyjack merged commit 3b04b56 into master Jun 26, 2026
1 check passed
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.

1 participant