diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-09-23 19:21:42 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-09-24 09:18:54 +0100 |
| commit | 4022f21a20dc9e6ef098c1825b66a82e11ac7229 (patch) | |
| tree | 7ef62de3b07af9e30a0510086652b80fbb8ab9f2 /app | |
| parent | ea517a3bcde172a7403de36143979b17050fb005 (diff) | |
| download | webtrees-4022f21a20dc9e6ef098c1825b66a82e11ac7229.tar.gz webtrees-4022f21a20dc9e6ef098c1825b66a82e11ac7229.tar.bz2 webtrees-4022f21a20dc9e6ef098c1825b66a82e11ac7229.zip | |
Guzzle now throws a GuzzleException
Diffstat (limited to 'app')
| -rw-r--r-- | app/Http/RequestHandlers/AutoCompletePlace.php | 10 | ||||
| -rw-r--r-- | app/Module/ModuleCustomTrait.php | 5 | ||||
| -rw-r--r-- | app/Module/ModuleMapAutocompleteTrait.php | 4 | ||||
| -rw-r--r-- | app/Services/UpgradeService.php | 5 |
4 files changed, 7 insertions, 17 deletions
diff --git a/app/Http/RequestHandlers/AutoCompletePlace.php b/app/Http/RequestHandlers/AutoCompletePlace.php index 866a8da1c9..839578ea92 100644 --- a/app/Http/RequestHandlers/AutoCompletePlace.php +++ b/app/Http/RequestHandlers/AutoCompletePlace.php @@ -19,25 +19,15 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; -use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Module\ModuleMapAutocompleteInterface; use Fisharebest\Webtrees\Place; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\SearchService; -use Fisharebest\Webtrees\Site; use Fisharebest\Webtrees\Tree; -use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; use Illuminate\Support\Collection; -use Iodev\Whois\Modules\Module; use Psr\Http\Message\ServerRequestInterface; use function assert; -use function is_array; -use function json_decode; -use function rawurlencode; - -use const JSON_THROW_ON_ERROR; /** * Autocomplete handler for places diff --git a/app/Module/ModuleCustomTrait.php b/app/Module/ModuleCustomTrait.php index 60e651d0c3..e61983002b 100644 --- a/app/Module/ModuleCustomTrait.php +++ b/app/Module/ModuleCustomTrait.php @@ -25,12 +25,11 @@ use Fisharebest\Webtrees\Exceptions\HttpNotFoundException; use Fisharebest\Webtrees\Mime; use Fisharebest\Webtrees\Registry; use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\GuzzleException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use function str_contains; -use function strlen; use function strtolower; /** @@ -96,7 +95,7 @@ trait ModuleCustomTrait return $version; } } - } catch (RequestException $ex) { + } catch (GuzzleException $ex) { // Can't connect to the server? } diff --git a/app/Module/ModuleMapAutocompleteTrait.php b/app/Module/ModuleMapAutocompleteTrait.php index a886c588c9..357feab7b6 100644 --- a/app/Module/ModuleMapAutocompleteTrait.php +++ b/app/Module/ModuleMapAutocompleteTrait.php @@ -22,7 +22,7 @@ namespace Fisharebest\Webtrees\Module; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Registry; use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Psr7\Request; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -63,7 +63,7 @@ trait ModuleMapAutocompleteTrait return []; }, $ttl); - } catch (RequestException $ex) { + } catch (GuzzleException $ex) { // Service down? Quota exceeded? // Don't try for another hour. $cache->remember($key, fn () => [], 3600); diff --git a/app/Services/UpgradeService.php b/app/Services/UpgradeService.php index 21e08d2807..d0a32179f2 100644 --- a/app/Services/UpgradeService.php +++ b/app/Services/UpgradeService.php @@ -26,7 +26,7 @@ use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Site; use Fisharebest\Webtrees\Webtrees; use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\GuzzleException; use Illuminate\Support\Collection; use League\Flysystem\Filesystem; use League\Flysystem\FilesystemException; @@ -146,6 +146,7 @@ class UpgradeService * @param string $path * * @return int The number of bytes downloaded + * @throws GuzzleException * @throws FilesystemException */ public function downloadFile(string $url, FilesystemOperator $filesystem, string $path): int @@ -322,7 +323,7 @@ class UpgradeService Site::setPreference('LATEST_WT_VERSION', $response->getBody()->getContents()); Site::setPreference('LATEST_WT_VERSION_TIMESTAMP', (string) $current_timestamp); } - } catch (RequestException $ex) { + } catch (GuzzleException $ex) { // Can't connect to the server? // Use the existing information about latest versions. } |
