Skip to content

Fix: Fail content migration when adapt-migrations swallows step errors#219

Merged
taylortom merged 1 commit into
masterfrom
fix/content-migration-error-handling
Jun 26, 2026
Merged

Fix: Fail content migration when adapt-migrations swallows step errors#219
taylortom merged 1 commit into
masterfrom
fix/content-migration-error-handling

Conversation

@taylortom

Copy link
Copy Markdown
Contributor

Fixes #218

Fix

  • Surface swallowed adapt-migrations failures: a failed migration step is logged and rolled back by migrate(), which resolves successfully without throwing, so runContentMigration returned as if the migration succeeded and the import/update continued.
  • runContentMigration now wraps the migration logger (createErrorCapturingLogger), captures error-level logs emitted during migrate(), and throws if any occurred — so the existing try/catch in migrateCourseData (raises FW_IMPORT_MIGRATION_FAILED) and migrateExistingCourses fires as intended.

Testing

  • New tests/utils-createErrorCapturingLogger.spec.js covering forwarding, error capture, multi-arg/Error handling, and missing-method tolerance.
  • Extended tests/utils-runContentMigration.spec.js: throws when migrate() logs an error, does not throw otherwise.
  • Full suite: 204 passing; standard clean.

Notes

fixes #218)

adapt-migrations migrate() logs and rolls back a failed migration step but
resolves successfully without throwing, so the existing try/catch in
migrateCourseData and migrateExistingCourses never fired and a failed
content migration was silently treated as successful.

Wrap the migration logger to capture error-level logs emitted during
migrate() and throw if any occurred, so the callers surface the failure
(FW_IMPORT_MIGRATION_FAILED on import). Stopgap pending adapt-migrations
error propagation; revert tracked in #217.
@taylortom
taylortom merged commit 4c19583 into master Jun 26, 2026
2 checks passed
@taylortom
taylortom deleted the fix/content-migration-error-handling branch June 26, 2026 10:26
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content migration failures are not surfaced: import succeeds despite errored migrations

1 participant