]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Bookmark plugin: graceful error out for failure to import a delicious bookmark due...
authorBrion Vibber <brion@pobox.com>
Fri, 31 Dec 2010 20:09:15 +0000 (12:09 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 31 Dec 2010 20:09:15 +0000 (12:09 -0800)
plugins/Bookmark/deliciousbookmarkimporter.php

index 297ef812461fc401e38559d93a0c83035be6d556..545c336860e769721e147a8f28ba88117bd3e0de 100644 (file)
@@ -96,13 +96,19 @@ class DeliciousBookmarkImporter extends QueueHandler
         $addDate = $a->getAttribute('add_date');
         $created = common_sql_date(intval($addDate));
 
-        $saved = Bookmark::saveNew($user->getProfile(),
-                                   $title,
-                                   $url,
-                                   $tags,
-                                   $description,
-                                   array('created' => $created,
-                                         'distribute' => false));
+        try {
+            $saved = Bookmark::saveNew($user->getProfile(),
+                                       $title,
+                                       $url,
+                                       $tags,
+                                       $description,
+                                       array('created' => $created,
+                                             'distribute' => false));
+        } catch (ClientException $e) {
+            // Most likely a duplicate -- continue on with the rest!
+            common_log(LOG_ERR, "Error importing delicious bookmark to $url: " . $e->getMessage());
+            return true;
+        }
 
         return true;
     }