feat: Catch exception on anki not connected

This commit is contained in:
Dendy 2025-10-13 07:08:42 +02:00
parent 4c010ed5dc
commit 282d7adc4f
1 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ use App\Utils\Japanese;
use App\Utils\Number;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapQueryParameter;
@ -176,7 +177,11 @@ class KanjiController extends AbstractController
"{$this->getParameter('kernel.project_dir')}/data/kanken-links.json",
), true);
$terms = null;
try {
$terms = $this->anki->searchTerms($charStr);
} catch (TransportException) {
}
$ebookRef = require "$this->varBasepath/ebook-ref.php";