Better error handling if missing cache file

This commit is contained in:
Pinga 2024-02-05 18:40:18 +02:00
parent 6932ae28c5
commit 9070788a31
2 changed files with 20 additions and 2 deletions

View file

@ -288,6 +288,12 @@ function extractDomainAndTLD($urlString) {
$cachedFile = $cache->getItem($cacheKey);
$fileContent = $cachedFile->get();
// Check if fileContent is not null
if (null === $fileContent) {
// Handle the error gracefully
throw new \Exception("The TLDs cache file is missing or unreadable");
}
// Load a list of test TLDs used in your QA environment
$testTlds = explode(',', envi('TEST_TLDS'));