File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ class MySQLExceptionInterpreter {
1515 * @throw PDOException
1616 */
1717 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 ());
1920 $ message = (string ) $ exception ->getMessage ();
2021 switch ($ code ) {
2122 case 2006 : throw new DatabaseHasGoneAwayException ($ message , $ code , $ exception );
@@ -26,7 +27,8 @@ public function throwMoreConcreteException(PDOException $exception) {
2627 case 1169 :
2728 case 1586 : throw new DuplicateUniqueKeyException ($ message , $ code , $ exception );
2829 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 );
3032 }
3133 /** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */
3234 if (!is_string ($ message ) || !is_int ($ code )) {
You can’t perform that action at this time.
0 commit comments