gofr icon indicating copy to clipboard operation
gofr copied to clipboard

[WIP] REFACTOR: parseRange func & error messages

Open nidhey27 opened this issue 5 months ago • 4 comments

Closes: #1000

Description:

Refactor parseRange Function

This PR refactors the parseRange function in the cron file to enhance error handling and improve parsing logic. The changes include:

  • Updated Error Handling:

    • Enhanced error messages for errOutOfRange and errParsing to provide clearer and more accurate information.
  • Refactored Functions:

    • parseRange: Improved error handling and parsing logic for ranges and individual values.
    • processPart: Refined handling of both value and range parts.
    • handleValue: Enhanced error reporting for out-of-range values.
    • handleRange: Added checks for invalid range formats and adjusted error messages.
  • Added Unit Tests:

    • Comprehensive tests for processPart, handleValue, and handleRange to cover various edge cases and validate the refactored logic.

Checklist:

  • [x] I have formatted my code using goimport and golangci-lint.
  • [x] All new code is covered by unit tests.
  • [x] This PR does not decrease the overall code coverage.
  • [ ] I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

nidhey27 avatar Sep 19 '24 10:09 nidhey27