Skip to content

Fixes #669: Log warning when ValidationError occurs during translation.#907

Open
Marvinrose wants to merge 5 commits intowagtail:mainfrom
Marvinrose:fix/log-validation-error-on-translation
Open

Fixes #669: Log warning when ValidationError occurs during translation.#907
Marvinrose wants to merge 5 commits intowagtail:mainfrom
Marvinrose:fix/log-validation-error-on-translation

Conversation

@Marvinrose
Copy link
Copy Markdown
Contributor

Previously, when save_target() raised a ValidationError during translation, the error was silently suppressed. This caused a confusing DoesNotExist error to surface to the user instead of the real cause.

Changes

  • operations.py: replaced contextlib.suppress(ValidationError) with a logger.warning() so the actual error is visible in logs.
  • views/submit_translations.py: wrapped get_translation() with contextlib.suppress(DoesNotExist) so the view degrades gracefully when save_target() fails
  • Added a test to verify the warning is logged

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.03%. Comparing base (4492663) to head (df6f33c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #907      +/-   ##
==========================================
+ Coverage   93.02%   93.03%   +0.01%     
==========================================
  Files          47       47              
  Lines        4243     4251       +8     
  Branches      551      551              
==========================================
+ Hits         3947     3955       +8     
  Misses        177      177              
  Partials      119      119              

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants