fix(watcher): handle OCR errors and route failures to output#1690
Open
rjackr wants to merge 1 commit into
Open
fix(watcher): handle OCR errors and route failures to output#1690rjackr wants to merge 1 commit into
rjackr wants to merge 1 commit into
Conversation
rjackr
commented
May 26, 2026
- Wrap ocrmypdf execution in try-except to prevent watchdog thread crash on errors (e.g., PriorOcrFoundError)
- Move failed PDFs to the configured output directory instead of leaving them in input
- Append sanitized error reason to filename (truncated at first '-', max 60 chars) while preserving extension
- Apply same YYYY/MM subdirectory logic as successful conversions when output_dir_year_month is enabled
- Add 2-second delay before move and update file timestamp (os.utime) to force immediate SMB/Windows Explorer refresh
- Prevent filename collisions by appending incremental counters (_1, _2, etc.)
- Wrap ocrmypdf execution in try-except to prevent watchdog thread crash on errors (e.g., PriorOcrFoundError) - Move failed PDFs to the configured output directory instead of leaving them in input - Append sanitized error reason to filename (truncated at first '-', max 60 chars) while preserving extension - Apply same YYYY/MM subdirectory logic as successful conversions when output_dir_year_month is enabled - Add 2-second delay before move and update file timestamp (os.utime) to force immediate SMB/Windows Explorer refresh - Prevent filename collisions by appending incremental counters (_1, _2, etc.)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1690 +/- ##
=======================================
Coverage 89.55% 89.55%
=======================================
Files 134 134
Lines 11507 11507
Branches 1162 1162
=======================================
Hits 10305 10305
Misses 871 871
Partials 331 331 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.