From 58c06890052a07db57ab8d3d26c481e08b3de4e8 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Fri, 14 Dec 2018 09:58:55 +0100 Subject: [PATCH] Import: Improve exception info during storing rows --- library/Director/Import/Import.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/library/Director/Import/Import.php b/library/Director/Import/Import.php index 9fcbd4f7..3b5f879b 100644 --- a/library/Director/Import/Import.php +++ b/library/Director/Import/Import.php @@ -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() + ); } }