Skip to content

Fix #1169: Improve ConvertException error matching (#1170)#1170

Open
WarLikeLaux wants to merge 6 commits intoyiisoft:masterfrom
WarLikeLaux:fix-ConvertException-integrity-check
Open

Fix #1169: Improve ConvertException error matching (#1170)#1170
WarLikeLaux wants to merge 6 commits intoyiisoft:masterfrom
WarLikeLaux:fix-ConvertException-integrity-check

Conversation

@WarLikeLaux
Copy link
Copy Markdown

@WarLikeLaux WarLikeLaux commented Mar 29, 2026

Q A
Is bugfix? ✔️
New feature?
Docs added?
Tests added? ✔️
Breaks BC?
Fixed issues #1169

What does this PR do?

Restricts ConvertException matching so generic SQLSTATE[HY...] errors are no longer treated as IntegrityException, SQLSTATE[08...] errors are converted to ConnectionException, Oracle integrity violations are recognized by dedicated ORA-* codes, and MySQL/MariaDB timeout disconnect errors plus Oracle ORA-00942 keep 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. ConnectionException extends Exception, 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-mysql and yiisoft/db-migration, which still rely on IntegrityException for reconnect and Oracle migration paths.

@WarLikeLaux WarLikeLaux changed the title Fix #1169: Improve ConvertException error matching Fix #1169: Improve ConvertException error matching (#1170) Mar 29, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.63%. Comparing base (dffa745) to head (2c06a9d).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@WarLikeLaux WarLikeLaux marked this pull request as draft March 29, 2026 09:21
@WarLikeLaux WarLikeLaux marked this pull request as ready for review March 29, 2026 10:00
Comment on lines +80 to +83
'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.',
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These also should be converted to ConnectionException

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It requires to add changes in these packages too. The branch name should be the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants