Conversation
Factor the seed processing out of finisher `worker`. Replace all `panic()` with proper error returning. The logic remains the same. Relevant to: internetarchive#473
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #476 +/- ##
==========================================
- Coverage 56.45% 56.41% -0.05%
==========================================
Files 130 130
Lines 8052 8060 +8
==========================================
+ Hits 4546 4547 +1
- Misses 3145 3151 +6
- Partials 361 362 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the finisher component by extracting seed processing logic from the worker method into a separate handleSeed function and replacing all panic() calls with proper error handling. The refactoring improves code organization and error handling without changing the underlying business logic.
Key changes:
- Extracted seed processing logic into a new
handleSeedmethod for better separation of concerns - Replaced all
panic()calls with proper error returns and structured error messages - Enhanced error messages with contextual information including worker ID and seed ID
| continue | ||
| } | ||
| if err := seed.CheckConsistency(); err != nil { | ||
| return fmt.Errorf("seed consistency check failed with err: for %s: %s", err.Error(), seed.GetShortID()) |
There was a problem hiding this comment.
The error message format is awkward with 'with err: for %s'. Consider rephrasing to 'seed consistency check failed for %s: %w' and use error wrapping instead of .Error().
| return fmt.Errorf("seed consistency check failed with err: for %s: %s", err.Error(), seed.GetShortID()) | |
| return fmt.Errorf("seed consistency check failed for %s: %w", seed.GetShortID(), err) |
Factor the seed processing out of finisher
worker.Replace all
panic()with proper error returning.The logic remains the same.
Relevant to: #473