]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better exception handling in delicious importer
authorEvan Prodromou <evan@status.net>
Tue, 9 Aug 2011 20:07:36 +0000 (13:07 -0700)
committerEvan Prodromou <evan@status.net>
Tue, 9 Aug 2011 20:07:36 +0000 (13:07 -0700)
plugins/Bookmark/deliciousbackupimporter.php

index 54a618b73ae6638930e7749b013f06983a384404..0ceba61d89a1619b009cf771bf4e20b82b335a1a 100644 (file)
@@ -74,7 +74,13 @@ class DeliciousBackupImporter extends QueueHandler
     {
         list($user, $body) = $data;
 
-        $doc = $this->importHTML($body);
+        try {
+            $doc = $this->importHTML($body);
+        } catch (ClientException $cex) {
+            // XXX: message to the user
+            common_log(LOG_WARNING, $cex->getMessage());
+            return true;
+        }
 
         // If we can't parse it, it's no good
 
@@ -85,8 +91,9 @@ class DeliciousBackupImporter extends QueueHandler
         $dls = $doc->getElementsByTagName('dl');
 
         if ($dls->length != 1) {
-            // TRANS: Client exception thrown when a file upload is incorrect.
-            throw new ClientException(_m('Bad import file.'));
+            // XXX: message to the user
+            common_log(LOG_WARNING, 'Bad input file');
+            return true;
         }
 
         $dl = $dls->item(0);