Skip to content

Commit 6970611

Browse files
Throw new AfterCommitException from AbstractResource.php
If a callback in commit throws an excecption, the calling plugin needs to be able to distinguish this from a unsuccessful commit, so that it doesn't attempt a rollback on an already commited transaction. (Which would cause an “Asymmetric transaction rollback" error)
1 parent f0b320b commit 6970611

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/Magento/Framework/Model/ResourceModel/AbstractResource.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\DataObject;
1010
use Magento\Framework\Model\CallbackPool;
1111
use Magento\Framework\Serialize\Serializer\Json;
12+
use Magento\Framework\Exception\AfterCommitException;
1213

1314
/**
1415
* Abstract resource model
@@ -91,7 +92,7 @@ public function commit()
9192
call_user_func($callback);
9293
}
9394
} catch (\Exception $e) {
94-
throw $e;
95+
throw new AfterCommitException(null, null, $e);
9596
}
9697
}
9798
return $this;

0 commit comments

Comments
 (0)