better exception handling in delicious importer
This commit is contained in:
parent
776fbfd26a
commit
11f2078893
|
@ -74,7 +74,13 @@ class DeliciousBackupImporter extends QueueHandler
|
||||||
{
|
{
|
||||||
list($user, $body) = $data;
|
list($user, $body) = $data;
|
||||||
|
|
||||||
|
try {
|
||||||
$doc = $this->importHTML($body);
|
$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
|
// If we can't parse it, it's no good
|
||||||
|
|
||||||
|
@ -85,8 +91,9 @@ class DeliciousBackupImporter extends QueueHandler
|
||||||
$dls = $doc->getElementsByTagName('dl');
|
$dls = $doc->getElementsByTagName('dl');
|
||||||
|
|
||||||
if ($dls->length != 1) {
|
if ($dls->length != 1) {
|
||||||
// TRANS: Client exception thrown when a file upload is incorrect.
|
// XXX: message to the user
|
||||||
throw new ClientException(_m('Bad import file.'));
|
common_log(LOG_WARNING, 'Bad input file');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dl = $dls->item(0);
|
$dl = $dls->item(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user