Commit 9704412c authored by andrei.dincu's avatar andrei.dincu
Browse files

Issue #2249723 by andrei.dincu: Put httpClient()->get() request in try block...

Issue #2249723 by andrei.dincu: Put httpClient()->get() request in try block in xmlsitemap_engines.module
parent f49877fe
...@@ -145,13 +145,14 @@ function xmlsitemap_engines_submit_sitemaps($url, array $sitemaps) { ...@@ -145,13 +145,14 @@ function xmlsitemap_engines_submit_sitemaps($url, array $sitemaps) {
foreach ($sitemaps as $sitemap) { foreach ($sitemaps as $sitemap) {
$sitemap_url = url($sitemap->uri['path'], $sitemap->uri['options']); $sitemap_url = url($sitemap->uri['path'], $sitemap->uri['options']);
$submit_url = xmlsitemap_engines_prepare_url($url, $sitemap_url); $submit_url = xmlsitemap_engines_prepare_url($url, $sitemap_url);
$request = \Drupal::httpClient()->get($submit_url);
try { try {
$request = \Drupal::httpClient()->get($submit_url);
$data = $request->getBody(); $data = $request->getBody();
watchdog('xmlsitemap', 'Submitted the sitemap to %url and received response @code.', array('%url' => $submit_url, '@code' => $request->getStatusCode())); watchdog('xmlsitemap', 'Submitted the sitemap to %url and received response @code.', array('%url' => $submit_url, '@code' => $request->getStatusCode()));
} }
catch (RequestException $ex) { catch (RequestException $ex) {
watchdog_exception('xmlsitemap', 'Submitted the sitemap to %url failed with response @code.',array('%url' => $submit_url,'@code' => $request->getStatusCode())); watchdog('xmlsitemap', 'Submitted the sitemap to %url and received response @code.', array('%url' => $submit_url, '@code' => '404'));
//watchdog_exception('xmlsitemap', 'Submitted the sitemap to %url failed with response @code.',array('%url' => $submit_url,'@code' => '404'));
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment