Skip to content

Commit 56461f3

Browse files
committed
fix: support for new Laravel transaction onFailure callback
laravel/framework#55338
1 parent fc6488b commit 56461f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/PostgresEnhancedConnection.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ protected function handleQueryException(QueryException $e, $query, $bindings, Cl
165165
* @param int $currentAttempt
166166
* @param int $maxAttempts
167167
*/
168-
protected function handleTransactionException($e, $currentAttempt, $maxAttempts): void
168+
protected function handleTransactionException($e, $currentAttempt, $maxAttempts, ?Closure $onFailure = null): void
169169
{
170170
try {
171-
parent::handleTransactionException($e, $currentAttempt, $maxAttempts);
171+
parent::handleTransactionException($e, $currentAttempt, $maxAttempts, $onFailure);
172172
} catch (Throwable $handleException) {
173173
if ($e instanceof ZeroDowntimeMigrationTimeoutException) {
174174
Container::getInstance()->get(ZeroDowntimeMigrationSupervisor::class)->stop();
@@ -181,6 +181,10 @@ protected function handleTransactionException($e, $currentAttempt, $maxAttempts)
181181
throw $e;
182182
}
183183

184+
if (null !== $onFailure) {
185+
$onFailure($e);
186+
}
187+
184188
throw $handleException;
185189
}
186190
}

0 commit comments

Comments
 (0)