From 2ecb00c492c1312e7214c5bb1c2d256225cf2c73 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 15 Jun 2009 03:43:06 +0800 Subject: Trap gallery2 errors when we try to load an invalid user id and abort loading that user. Signed-off-by: --- modules/g2_import/helpers/g2_import.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/g2_import/helpers') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 33cfc158..30ddda50 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -253,7 +253,14 @@ class g2_import_Core { $g2_admin_group_id = g2(GalleryCoreApi::getPluginParameter("module", "core", "id.adminGroup")); - $g2_user = g2(GalleryCoreApi::loadEntitiesById($g2_user_id)); + try { + $g2_user = g2(GalleryCoreApi::loadEntitiesById($g2_user_id)); + } catch (Exception $e) { + $msg = t("Failed to import Gallery 2 user with id: %id", array("id" => $g2_user_id)); + Kohana::log("alert", $msg); + message::warning($msg); + return; + } $g2_groups = g2(GalleryCoreApi::fetchGroupsForUser($g2_user->getId())); try { -- cgit v1.2.3