File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ class MySQLExceptionInterpreter {
15
15
* @throw PDOException
16
16
*/
17
17
public function throwMoreConcreteException (PDOException $ exception ) {
18
- $ code = $ exception ->getCode ();
18
+ $ errorInfo = $ exception ->errorInfo ;
19
+ $ code = is_array ($ errorInfo ) && isset ($ errorInfo [1 ]) ? ((int ) $ errorInfo [1 ]) : ((int ) $ exception ->getCode ());
19
20
$ message = (string ) $ exception ->getMessage ();
20
21
switch ($ code ) {
21
22
case 2006 : throw new DatabaseHasGoneAwayException ($ message , $ code , $ exception );
@@ -26,7 +27,8 @@ public function throwMoreConcreteException(PDOException $exception) {
26
27
case 1169 :
27
28
case 1586 : throw new DuplicateUniqueKeyException ($ message , $ code , $ exception );
28
29
case 1216 :
29
- case 1217 : throw new IntegrityConstraintViolationException ($ message , (int ) $ code , $ exception );
30
+ case 1217 :
31
+ case 1452 : throw new IntegrityConstraintViolationException ($ message , (int ) $ code , $ exception );
30
32
}
31
33
/** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */
32
34
if (!is_string ($ message ) || !is_int ($ code )) {
You can’t perform that action at this time.
0 commit comments