Fail more gracefully when an error occurs in the info providers

This commit is contained in:
Jan Böhmer 2026-01-25 18:22:47 +01:00
parent 56fa2a9396
commit d93dfd577e
2 changed files with 22 additions and 0 deletions

View file

@ -40,10 +40,13 @@ use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Contracts\HttpClient\Exception\ExceptionInterface;
use function Symfony\Component\Translation\t;
#[Route('/tools/info_providers')]
@ -178,6 +181,13 @@ class InfoProviderController extends AbstractController
$exceptionLogger->error('Error during info provider search: ' . $e->getMessage(), ['exception' => $e]);
} catch (OAuthReconnectRequiredException $e) {
$this->addFlash('error', t('info_providers.search.error.oauth_reconnect', ['%provider%' => $e->getProviderName()]));
} catch (TransportException $e) {
$this->addFlash('error', t('info_providers.search.error.transport_exception'));
$exceptionLogger->error('Transport error during info provider search: ' . $e->getMessage(), ['exception' => $e]);
} catch (\RuntimeException $e) {
$this->addFlash('error', t('info_providers.search.error.general_exception', ['%type%' => (new \ReflectionClass($e))->getShortName()]));
//Log the exception
$exceptionLogger->error('Error during info provider search: ' . $e->getMessage(), ['exception' => $e]);
}

View file

@ -14274,5 +14274,17 @@ Buerklin-API Authentication server:
<target>[Part] ID</target>
</segment>
</unit>
<unit id="WdszgJG" name="info_providers.search.error.general_exception">
<segment>
<source>info_providers.search.error.general_exception</source>
<target>Unknown error while trying to retrieve parts from info provider: %type%. Check that your providers are configured correctly and access keys are correct. See server logs for more information.</target>
</segment>
</unit>
<unit id="RFhwYWd" name="info_providers.search.error.transport_exception">
<segment>
<source>info_providers.search.error.transport_exception</source>
<target>Transport error while retrieving information from the providers. Check that your server has internet accesss. See server logs for more info.</target>
</segment>
</unit>
</file>
</xliff>