Handle 404 errors and add debug call

This commit is contained in:
Frédéric Guillot 2013-08-29 20:52:44 -04:00
parent 509d36c4b8
commit 1429c2f44e
2 changed files with 7 additions and 2 deletions

View File

@ -180,8 +180,10 @@ function import_feed($url)
$feed = $parser->execute(); $feed = $parser->execute();
if ($feed === false) return false; if ($feed === false || ! $feed->title || ! $feed->url) {
if (! $feed->title || ! $feed->url) return false; write_debug();
return false;
}
$db = \PicoTools\singleton('db'); $db = \PicoTools\singleton('db');

View File

@ -58,6 +58,9 @@ abstract class Client
$this->is_modified = false; $this->is_modified = false;
Logging::log(\get_called_class().' Resource not modified'); Logging::log(\get_called_class().' Resource not modified');
} }
else if ($response['status'] == 404) {
Logging::log(\get_called_class().' Resource not found');
}
else { else {
$this->etag = isset($response['headers']['ETag']) ? $response['headers']['ETag'] : ''; $this->etag = isset($response['headers']['ETag']) ? $response['headers']['ETag'] : '';
$this->last_modified = isset($response['headers']['Last-Modified']) ? $response['headers']['Last-Modified'] : ''; $this->last_modified = isset($response['headers']['Last-Modified']) ? $response['headers']['Last-Modified'] : '';