yiisoft / yiisoft/db

Error «no connection to server» is detected as Intergrity exception

Open Beginner friendly
#1,169 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
216
Forks
51
Avg merge
3d 10h
Merged PRs (30d)
2

Description

Description

When connection to MySQL server is lost you get

Yiisoft\Db\Exception\IntegrityException: SQLSTATE[HY000]: General error: 7 no connection to the server

instead of more correct Yiisoft\Db\Exception\Exception or, maybe, more specific, but not existing ConnectionException.

Source:
https://github.com/yiisoft/db/blob/1f38570d71d1555a3c81885b978493302e9c933f/src/Exception/ConvertException.php#L19-L21

Package version

2.0

PHP version

8.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/Exception/ConvertException.php around lines 19–21 and inspect how the MySQL error SQLSTATE[HY000]: General error: 7 no connection to the server is classified. Reproduce the lost-connection case and verify that it no longer becomes an IntegrityException, using the most appropriate existing exception type or confirming whether a new connection-specific type is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.