summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-14 12:43:06 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-14 12:43:06 -0700
commitdc3ed06cd76ebc7b949865be789fb26590d63ed0 (patch)
tree7da4575444d6702de7df3c6e8d3d397a84339030
parent80b464fdbda4a10a318fa2203dbea8d51ba83709 (diff)
Trap gallery2 errors when we try to load an invalid user id and abort loading that user.
-rw-r--r--modules/g2_import/helpers/g2_import.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 19d02f25..f385907d 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -259,7 +259,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 {