Skip to content

Commit ea37b56

Browse files
github-actions[bot]claude-bot
authored andcommitted
fix(sqlite): preserve original exception across rollback failures
The createFulltextIndex / dropFulltextIndexById / createAttributes catch blocks called rollbackTransaction() inline, which throws DatabaseException("Failed to rollback transaction: ...") on failure and replaces the actionable root cause. Wrap rollback so its own error is swallowed and the original \$e is what propagates.
1 parent 7cd345b commit ea37b56

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/Database/Adapter/SQLite.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,13 @@ protected function createFulltextIndex(string $collection, string $id, array $at
794794

795795
$this->commitTransaction();
796796
} catch (\Throwable $e) {
797-
$this->rollbackTransaction();
797+
// Swallow rollback failures so the original cause keeps its
798+
// place at the top of the stack — a "Failed to rollback"
799+
// wrapper hides what actually went wrong.
800+
try {
801+
$this->rollbackTransaction();
802+
} catch (\Throwable) {
803+
}
798804
throw $e;
799805
}
800806

@@ -941,7 +947,10 @@ protected function dropFulltextIndexById(string $collection, string $id): bool
941947
$this->getPDO()->prepare($sql)->execute();
942948
$this->commitTransaction();
943949
} catch (\Throwable $e) {
944-
$this->rollbackTransaction();
950+
try {
951+
$this->rollbackTransaction();
952+
} catch (\Throwable) {
953+
}
945954
throw $e;
946955
}
947956

@@ -2542,7 +2551,10 @@ public function createAttributes(string $collection, array $attributes): bool
25422551
}
25432552
$this->commitTransaction();
25442553
} catch (\Throwable $e) {
2545-
$this->rollbackTransaction();
2554+
try {
2555+
$this->rollbackTransaction();
2556+
} catch (\Throwable) {
2557+
}
25462558
throw $e;
25472559
}
25482560

0 commit comments

Comments
 (0)