mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
DbObject: provide friendler not-found errors
This commit is contained in:
parent
af71138227
commit
4af6b11f58
@ -560,12 +560,20 @@ abstract class DbObject
|
|||||||
$properties = $this->db->fetchRow($select);
|
$properties = $this->db->fetchRow($select);
|
||||||
|
|
||||||
if (empty($properties)) {
|
if (empty($properties)) {
|
||||||
throw new NotFoundError(
|
|
||||||
'Got no "%s" data for: %s (%s)',
|
if (is_array($this->getKeyName())) {
|
||||||
$this->table,
|
throw new NotFoundError(
|
||||||
$this->getLogId(),
|
'Failed to load %s for %s',
|
||||||
$this->createWhere()
|
$this->table,
|
||||||
);
|
$this->createWhere()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw new NotFoundError(
|
||||||
|
'Failed to load %s "%s"',
|
||||||
|
$this->table,
|
||||||
|
$this->getLogId()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->setDbProperties($properties);
|
return $this->setDbProperties($properties);
|
||||||
@ -743,7 +751,6 @@ abstract class DbObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete item from DB
|
* Delete item from DB
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user