Uh oh!
There was an error while loading. Please reload this page.
New #868: Add SerializationFailureException - #1196
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #1196 +/- ##
=========================================
Coverage 98.62% 98.62% - Complexity 1645 1646 +1
=========================================
Files 120 120 Lines 4288 4290 +2 =========================================
+ Hits 4229 4231 +2
Misses 59 59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a database exception for SQLSTATE 40001 serialization failures.
Changes:
- Adds
SerializationFailureException. - Maps SQLSTATE
40001centrally and adds a test. - Updates the changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Exception/SerializationFailureException.php | Defines the new exception type. |
src/Exception/ConvertException.php | Converts matching failures to the new type. |
tests/Db/Exception/ConvertExceptionTest.php | Tests serialization-failure conversion. |
CHANGELOG.md | Documents the feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| if ( | ||
| ($errorInfo[0] ?? null) === '40001' | ||
| || str_contains($this->e->getMessage(), self::MSG_SERIALIZATION_FAILURE) |
There was a problem hiding this comment.
Are there cases when ($errorInfo[0] ?? null) === '40001' is not enough?
There was a problem hiding this comment.
in real usage PDO always populates errorInfo, so the message fallback only served manually constructed exceptions I Removed it so the check now relies solely on $errorInfo[0] and the test sets errorInfo the way PDO would.
Fix#868
Adds
SerializationFailureExceptionfor SQLSTATE code 40001 (serialization failure, e.g. transaction deadlock in concurrent updates). The code is the same for all databases, so the conversion is done centrally inConvertException, next to the existingIntegrityExceptionmapping.