Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 699d721

Browse files
committed
Catch Guzzle's exceptions
Signed-off-by: Yoshi2889 <[email protected]>
1 parent bfa4d99 commit 699d721

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/LinkSniffer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace WildPHP\Modules\LinkSniffer;
2222

23+
use GuzzleHttp\Exception\ClientException;
2324
use WildPHP\API\ShortenUri;
2425
use WildPHP\BaseModule;
2526
use WildPHP\CoreModules\Connection\IrcDataObject;
@@ -83,7 +84,14 @@ public function sniffLinks(IrcDataObject $message)
8384
return;
8485
}
8586

86-
$this->uriCache->addCacheItem($uri, $title, $shortUri);
87+
// ClientExceptions can be thrown by Guzzle. If one occurs, just give up.
88+
catch (ClientException $e)
89+
{
90+
return;
91+
}
92+
93+
if (!empty($title) && !empty($shortUri))
94+
$this->uriCache->addCacheItem($uri, $title, $shortUri);
8795
}
8896
else
8997
{

0 commit comments

Comments
 (0)