mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Specify explicit duplicate key exception in DB class
This commit is contained in:
parent
265db89448
commit
07110829e7
2 changed files with 7 additions and 1 deletions
|
@ -133,7 +133,7 @@ class DbConnection{
|
||||||
}
|
}
|
||||||
elseif($ex->getCode() == '23000'){
|
elseif($ex->getCode() == '23000'){
|
||||||
// Duplicate key, bubble this up without logging it so the business logic can handle it
|
// Duplicate key, bubble this up without logging it so the business logic can handle it
|
||||||
throw($ex);
|
throw new Exceptions\DuplicateDatabaseKeyException();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$done = true;
|
$done = true;
|
||||||
|
|
6
lib/Exceptions/DuplicateDatabaseKeyException.php
Normal file
6
lib/Exceptions/DuplicateDatabaseKeyException.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?
|
||||||
|
namespace Exceptions;
|
||||||
|
|
||||||
|
class DuplicateDatabaseKeyException extends AppException{
|
||||||
|
protected $message = 'An attempted row insertion has violated the database unique index.';
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue