Commit aafa3256 authored by bvoynick's avatar bvoynick Committed by pifagor

Issue #3044390 by bvoynick, alex_optim, voleger: Curl timeouts are unhandled...

Issue #3044390 by bvoynick, alex_optim, voleger: Curl timeouts are unhandled in xmlsitemap_custom form validation
parent 967b5984
......@@ -8,6 +8,7 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Http\ClientFactory;
use Drupal\Core\Language\LanguageInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Path\AliasManagerInterface;
......@@ -232,6 +233,9 @@ class XmlSitemapCustomAddForm extends FormBase {
catch (ClientException $e) {
$form_state->setErrorByName('loc', $this->t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', ['@link' => $link['loc']]));
}
catch (ConnectException $e) {
$form_state->setErrorByName('loc', $this->t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', ['@link' => $link['loc']]));
}
parent::validateForm($form, $form_state);
}
......
......@@ -7,6 +7,7 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Http\ClientFactory;
use Drupal\Core\Language\LanguageInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Path\AliasManagerInterface;
......@@ -192,6 +193,10 @@ class XmlSitemapCustomEditForm extends FormBase {
catch (ClientException $e) {
$form_state->setErrorByName('loc', $this->t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', ['@link' => $link['loc']]));
}
catch (ConnectException $e) {
$form_state->setErrorByName('loc', $this->t('The custom link @link is either invalid or it cannot be accessed by anonymous users.', ['@link' => $link['loc']]));
}
parent::validateForm($form, $form_state);
}
......
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