Catch more exceptions when fetching a feed
This commit is contained in:
parent
9a87b6a641
commit
d6f358536c
@ -43,12 +43,18 @@ function fetch_feed($url, $download_content = false, $etag = '', $last_modified
|
|||||||
$error_message = t('The content size exceeds to maximum allowed size.');
|
$error_message = t('The content size exceeds to maximum allowed size.');
|
||||||
} catch (PicoFeed\Client\TimeoutException $e) {
|
} catch (PicoFeed\Client\TimeoutException $e) {
|
||||||
$error_message = t('Connection timeout.');
|
$error_message = t('Connection timeout.');
|
||||||
|
} catch (PicoFeed\Client\ForbiddenException $e) {
|
||||||
|
$error_message = t('Not allowed to fetch feed.');
|
||||||
|
} catch (PicoFeed\Client\UnauthorizedException $e) {
|
||||||
|
$error_message = t('Not allowed to fetch feed.');
|
||||||
} catch (PicoFeed\Parser\MalformedXmlException $e) {
|
} catch (PicoFeed\Parser\MalformedXmlException $e) {
|
||||||
$error_message = t('Feed is malformed.');
|
$error_message = t('Feed is malformed.');
|
||||||
} catch (PicoFeed\Reader\SubscriptionNotFoundException $e) {
|
} catch (PicoFeed\Reader\SubscriptionNotFoundException $e) {
|
||||||
$error_message = t('Unable to find a subscription.');
|
$error_message = t('Unable to find a subscription.');
|
||||||
} catch (PicoFeed\Reader\UnsupportedFeedFormatException $e) {
|
} catch (PicoFeed\Reader\UnsupportedFeedFormatException $e) {
|
||||||
$error_message = t('Unable to detect the feed format.');
|
$error_message = t('Unable to detect the feed format.');
|
||||||
|
} catch (PicoFeed\PicoFeedException $e) {
|
||||||
|
$error_message = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($feed, $resource, $error_message);
|
return array($feed, $resource, $error_message);
|
||||||
|
Loading…
Reference in New Issue
Block a user