Soap timeout causes page crash
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3582878. -->
Reported by: [philipnorton42](https://www.drupal.org/user/545978)
Related to !42
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>For some reason the Whitespace API has been slow today, and when the service takes longer than 30 seconds to respond the page crashes with the following error.</p>
<pre>GuzzleHttp\Exception\ConnectException: cURL error 28: Connection timed out after 30003 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://fcbapi-municipal-live.whitespacews.com/WSAPIService.svc?wsdlWSAPIService.svc/GetAddresses in GuzzleHttp\Handler\CurlFactory::createRejection() (line 277 of /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php).</pre><p>The page crashes happens because Guzzle is throwing a \GuzzleHttp\Exception\ConnectException, which isn't accounted for in the makeSoapCall() method in the WhitespaceDataProvider class.</p>
<p>Also, the timeout for the call is set to the default of 30 seconds, which is a long time for the user to wait around to see a crash.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Difficult to reproduce, but if the Whitespace API is slow then this error will happen after a long time.</p>
<p>You can artificially create this error by setting the connect_timeout option of the request to something silly, like 0.01 seconds.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>I propose two changes here.</p>
<p>1) Decrease the timeout to 10 seconds. Still a long time, but not too long (perhaps?).<br>
2) Catch the ConnectException and throw a normal WhitespaceException, which is handled cleanly upstream.</p>
<p>I'll create a MR with that change.</p>
issue