From: Evan Prodromou Date: Tue, 9 Aug 2011 20:07:36 +0000 (-0700) Subject: better exception handling in delicious importer X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=11f2078893b7124149f225927c5d42f9d7358c1e;p=quix0rs-gnu-social.git better exception handling in delicious importer --- diff --git a/plugins/Bookmark/deliciousbackupimporter.php b/plugins/Bookmark/deliciousbackupimporter.php index 54a618b73a..0ceba61d89 100644 --- a/plugins/Bookmark/deliciousbackupimporter.php +++ b/plugins/Bookmark/deliciousbackupimporter.php @@ -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);