Skip to content

Commit 5a0aba2

Browse files
committed
- MySQLExceptionInterpreter::throwMoreConcreteException now handles SQL-Error-Codes 1216, 1217
1 parent fa83e46 commit 5a0aba2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Databases/MySQL/MySQLExceptionInterpreter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Kir\MySQL\Databases\MySQL;
33

44
use Kir\MySQL\Exceptions\DatabaseHasGoneAwayException;
5+
use Kir\MySQL\Exceptions\IntegrityConstraintViolationException;
56
use Kir\MySQL\Exceptions\SqlException;
67
use PDOException;
78
use Kir\MySQL\Exceptions\SqlDeadLockException;
@@ -24,6 +25,8 @@ public function throwMoreConcreteException(PDOException $exception) {
2425
case 1062:
2526
case 1169:
2627
case 1586: throw new DuplicateUniqueKeyException($message, $code, $exception);
28+
case 1216:
29+
case 1217: throw new IntegrityConstraintViolationException($message, (int) $code, $exception);
2730
}
2831
/** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */
2932
if(!is_string($message) || !is_int($code)) {

0 commit comments

Comments
 (0)