Skip to content

Commit

Permalink
Merge pull request #1741 from Icinga/import-error-handling
Browse files Browse the repository at this point in the history
Import: Improve exception info during storing rows
  • Loading branch information
lazyfrosch authored Dec 14, 2018
2 parents 3531839 + 58c0689 commit 79482bb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions library/Director/Import/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,20 @@ protected function storeRowset()
}

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()
);
}
}

Expand Down

0 comments on commit 79482bb

Please sign in to comment.