Fix #1169: Improve ConvertException error matching (#1170)#1170
Fix #1169: Improve ConvertException error matching (#1170)#1170WarLikeLaux wants to merge 6 commits intoyiisoft:masterfrom
ConvertException error matching (#1170)#1170Conversation
ConvertException error matchingConvertException error matching (#1170)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1170 +/- ##
=========================================
Coverage 98.62% 98.63%
- Complexity 1645 1657 +12
=========================================
Files 120 120
Lines 4292 4307 +15
=========================================
+ Hits 4233 4248 +15
Misses 59 59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| 'mysql server has gone away' => ['SQLSTATE[HY000]: General error: 2006 MySQL server has gone away'], | ||
| 'mysql server disconnected inactive client' => [ | ||
| 'SQLSTATE[HY000]: General error: 4031 The client was disconnected by the server because of inactivity.', | ||
| ], |
There was a problem hiding this comment.
These also should be converted to ConnectionException
There was a problem hiding this comment.
I agree, these cases should become ConnectionException. The problem is that the current CI matrix still installs yiisoft/db-mysql and yiisoft/db-migration, and they rely on the current IntegrityException behavior for these paths. If I switch HY000 2006/4031 here now, the MySQL and MariaDB jobs fail. Could you please advise what would be the preferred way to proceed?
There was a problem hiding this comment.
It requires to add changes in these packages too. The branch name should be the same
What does this PR do?
Restricts
ConvertExceptionmatching so genericSQLSTATE[HY...]errors are no longer treated asIntegrityException,SQLSTATE[08...]errors are converted toConnectionException, Oracle integrity violations are recognized by dedicatedORA-*codes, and MySQL/MariaDB timeout disconnect errors plus OracleORA-00942keep the current compatibility path.Adds unit coverage for message-based conversion and driver-suite coverage for foreign key violations and PDO command exception conversion.
No BC break.
ConnectionExceptionextendsException, and the targeted compatibility carve-outs preserve current behavior for dependent packages in this CI matrix.A full semantic cleanup would need coordinated changes in
yiisoft/db-mysqlandyiisoft/db-migration, which still rely onIntegrityExceptionfor reconnect and Oracle migration paths.