1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Improve error message for error 2006

Summary:
See discussion here:

https://secure.phabricator.com/chatlog/channel/%23phabricator/?at=21186

Basically, MySQL usually raises a good error if we exceed "max_allowed_packet":

  EXCEPTION: (AphrontQueryException) #1153: Got a packet bigger than 'max_allowed_packet' bytes

But sometimes it gives us a #2006 instead. This is documented, at least:

>"With some clients, you may also get a Lost connection to MySQL server during query error if the communication packet is too large."

  http://dev.mysql.com/doc/refman//5.5/en/packet-too-large.html

Try to improve the error message to point at this as a possible explanation.

Test Plan: Faked an error, had it throw, read exception message. See also chatlog.

Reviewers: btrahan, skrul

Reviewed By: skrul

CC: aran

Differential Revision: https://secure.phabricator.com/D2923
This commit is contained in:
epriestley 2012-07-05 16:03:58 -07:00
parent ae6661ac3f
commit 63be89ba00

View file

@ -217,8 +217,11 @@ abstract class AphrontMySQLDatabaseConnectionBase
switch ($errno) {
case 2013: // Connection Dropped
case 2006: // Gone Away
throw new AphrontQueryConnectionLostException($exmsg);
case 2006: // Gone Away
$more = "This error may occur if your MySQL 'wait_timeout' ".
"or 'max_allowed_packet' configuration values are set too low.";
throw new AphrontQueryConnectionLostException("{$exmsg}\n\n{$more}");
case 1213: // Deadlock
case 1205: // Lock wait timeout exceeded
throw new AphrontQueryDeadlockException($exmsg);