Skip to content
Snippets Groups Projects
Commit 292fb2d6 authored by David Cameron's avatar David Cameron
Browse files

Issue #1337898 by dcam, jessebeach, naxoc, kerby70, pwolanin, mgifford, mstef,...

Issue #1337898 by dcam, jessebeach, naxoc, kerby70, pwolanin, mgifford, mstef, larowlan: The watchdog message in aggregator.fetch.inc refers to $feed->title, a value that is not guaranteed to be known
parent 68831ac0
Branches
Tags
1 merge request!5Add core to composer.json
......@@ -127,8 +127,14 @@ class DefaultFetcher implements FetcherInterface, ContainerFactoryPluginInterfac
return TRUE;
}
catch (TransferException $e) {
$this->logger->warning('The feed from %site seems to be broken because of error "%error".', ['%site' => $feed->label(), '%error' => $e->getMessage()]);
$this->messenger->addWarning(new TranslatableMarkup('The feed from %site seems to be broken because of error "%error".', ['%site' => $feed->label(), '%error' => $e->getMessage()]));
$this->logger->warning('The feed from %url seems to be broken because of error "%error".', [
'%url' => $feed->getUrl(),
'%error' => $e->getMessage(),
]);
$this->messenger->addWarning(new TranslatableMarkup('The feed from %url seems to be broken because of error "%error".', [
'%url' => $feed->getUrl(),
'%error' => $e->getMessage(),
]));
return FALSE;
}
}
......
......@@ -35,7 +35,10 @@ class DefaultParser implements ParserInterface {
}
catch (ExceptionInterface $e) {
watchdog_exception('aggregator', $e);
$this->messenger()->addError(new TranslatableMarkup('The feed from %site seems to be broken because of error "%error".', ['%site' => $feed->label(), '%error' => $e->getMessage()]));
$this->messenger()->addError(new TranslatableMarkup('The feed from %url seems to be broken because of error "%error".', [
'%url' => $feed->getUrl(),
'%error' => $e->getMessage(),
]));
return FALSE;
}
......
......@@ -112,14 +112,14 @@ class FeedParserTest extends AggregatorTestBase {
*/
public function testInvalidFeed() {
// Simulate a typo in the URL to force a curl exception.
$invalid_url = 'http:/www.drupal.org';
$invalid_url = 'https:/www.drupal.org';
$feed = Feed::create(['url' => $invalid_url, 'title' => $this->randomMachineName()]);
$feed->save();
// Update the feed. Use the UI to be able to check the message easily.
$this->drupalGet('admin/config/services/aggregator');
$this->clickLink('Update items');
$this->assertSession()->pageTextContains('The feed from ' . $feed->label() . ' seems to be broken because of error');
$this->assertSession()->pageTextContains('The feed from ' . $feed->getUrl() . ' seems to be broken because of error');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment