feat: Catch exception on anki not connected
This commit is contained in:
parent
4c010ed5dc
commit
282d7adc4f
|
|
@ -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 = $this->anki->searchTerms($charStr);
|
||||
$terms = null;
|
||||
try {
|
||||
$terms = $this->anki->searchTerms($charStr);
|
||||
} catch (TransportException) {
|
||||
}
|
||||
|
||||
$ebookRef = require "$this->varBasepath/ebook-ref.php";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue