fix: preserve loadFile transaction errors - #315
Merged
chrispader merged 3 commits intoOct 1, 2026
Merged
Conversation
Give importSqlFile one transaction-finalization path, retain failing command context, and append rollback failures without masking the primary cause. Closes margelo#308.
|
@chrispader is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
Thanks for the PR @huytdps13400 ! 🙌🏼 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
A failed statement during a SQL-file import currently rolls back twice, and the second rollback masks the original SQL error. This PR gives the importer one transaction-finalization path and preserves the file path, failing line and command, and primary error. Rollback failures are appended without replacing the import failure.
The fix uses the current retained connection and keeps its lock for the entire import. It attempts rollback only after BEGIN succeeds, uses RAII for the input file, and registers an iOS example regression. Local host regressions against the bundled SQLite cover statement, BEGIN, COMMIT, and rollback failures, including connection reuse.
Reproduction
Import a file with a valid INSERT on line 1 and invalid SQL on line 2. The managed method must throw or reject with
CouldNotLoadFile, the path, line 2, the failing command, and the original syntax error. The inserted row must be absent, and a subsequent write on the same connection must succeed.Fixes #308.