Merge pull request #1741 from Icinga/import-error-handling

Import: Improve exception info during storing rows
This commit is contained in:
Markus Frosch 2018-12-14 10:49:26 +01:00 committed by GitHub
commit 79482bbf95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 6 deletions

View File

@ -301,12 +301,20 @@ class Import
}
foreach ($newRows as $row) {
$db->insert('imported_row', $rows[$row]);
foreach ($this->rowProperties[$row] as $property) {
$db->insert('imported_row_property', array(
'row_checksum' => $this->quoteBinary($row),
'property_checksum' => $property
));
try {
$db->insert('imported_row', $rows[$row]);
foreach ($this->rowProperties[$row] as $property) {
$db->insert('imported_row_property', array(
'row_checksum' => $this->quoteBinary($row),
'property_checksum' => $property
));
}
} catch (Exception $e) {
throw new IcingaException(
"Error while storing a row for '%s' into database: %s",
$rows[$row]['object_name'],
$e->getMessage()
);
}
}