mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 08:14:04 +02:00
DbObject: Add and use DuplicateKeyException
This commit is contained in:
parent
d7ddb3e63c
commit
ab169e4b78
@ -10,6 +10,7 @@ namespace Icinga\Module\Director\Data\Db;
|
|||||||
|
|
||||||
use Icinga\Exception\IcingaException as IE;
|
use Icinga\Exception\IcingaException as IE;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
|
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||||
use Icinga\Module\Director\Util;
|
use Icinga\Module\Director\Util;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Zend_Db_Adapter_Abstract;
|
use Zend_Db_Adapter_Abstract;
|
||||||
@ -725,7 +726,7 @@ abstract class DbObject
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($id && $this->existsInDb()) {
|
if ($id && $this->existsInDb()) {
|
||||||
throw new IE(
|
throw new DuplicateKeyException(
|
||||||
'Trying to recreate %s (%s)',
|
'Trying to recreate %s (%s)',
|
||||||
$table,
|
$table,
|
||||||
$this->getLogId()
|
$this->getLogId()
|
||||||
|
7
library/Director/Exception/DuplicateKeyException.php
Normal file
7
library/Director/Exception/DuplicateKeyException.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Icinga\Module\Director\Exception;
|
||||||
|
|
||||||
|
use Icinga\Exception\IcingaException;
|
||||||
|
|
||||||
|
class DuplicateKeyException extends IcingaException {}
|
Loading…
x
Reference in New Issue
Block a user