Skip to content

fix(watcher): handle OCR errors and route failures to output#1690

Open
rjackr wants to merge 1 commit into
ocrmypdf:mainfrom
rjackr:patch-1
Open

fix(watcher): handle OCR errors and route failures to output#1690
rjackr wants to merge 1 commit into
ocrmypdf:mainfrom
rjackr:patch-1

Conversation

@rjackr

@rjackr rjackr commented May 26, 2026

Copy link
Copy Markdown
  • 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

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.55%. Comparing base (ab6553f) to head (d6c9cf6).
⚠️ Report is 23 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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