Fix: Fail content migration when adapt-migrations swallows step errors#219
Merged
Merged
Conversation
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.
|
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Fixes #218
Fix
migrate(), which resolves successfully without throwing, sorunContentMigrationreturned as if the migration succeeded and the import/update continued.runContentMigrationnow wraps the migration logger (createErrorCapturingLogger), captures error-level logs emitted duringmigrate(), and throws if any occurred — so the existingtry/catchinmigrateCourseData(raisesFW_IMPORT_MIGRATION_FAILED) andmigrateExistingCoursesfires as intended.Testing
tests/utils-createErrorCapturingLogger.spec.jscovering forwarding, error capture, multi-arg/Error handling, and missing-method tolerance.tests/utils-runContentMigration.spec.js: throws whenmigrate()logs an error, does not throw otherwise.standardclean.Notes
try/catchonce that lands is tracked in Revert content-migration error-capturing workaround once adapt-migrations propagates errors #217.