|
7 | 7 | use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; |
8 | 8 | use App\Entity\Tenant\Feed; |
9 | 9 | use App\Entity\User; |
10 | | -use App\Exceptions\MissingFeedConfigurationException; |
11 | 10 | use App\Repository\FeedRepository; |
12 | 11 | use App\Repository\PlaylistSlideRepository; |
13 | 12 | use App\Service\FeedService; |
|
19 | 18 | use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; |
20 | 19 | use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; |
21 | 20 | use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; |
22 | | -use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; |
23 | 21 |
|
24 | 22 | final class FeedDataProvider implements ItemDataProviderInterface, RestrictedDataProviderInterface |
25 | 23 | { |
@@ -58,7 +56,7 @@ public function getItem(string $resourceClass, $id, string $operationName = null |
58 | 56 | // Get result. If there is a result this is returned. |
59 | 57 | try { |
60 | 58 | $feed = $queryBuilder->getQuery()->getOneOrNullResult(); |
61 | | - } catch (NonUniqueResultException $exception) { |
| 59 | + } catch (NonUniqueResultException) { |
62 | 60 | return null; |
63 | 61 | } |
64 | 62 |
|
@@ -91,12 +89,10 @@ public function getItem(string $resourceClass, $id, string $operationName = null |
91 | 89 | if ('get' === $operationName || 'get_feed_data' === $operationName) { |
92 | 90 | return new JsonResponse($this->feedService->getData($feed), 200); |
93 | 91 | } |
94 | | - } catch (MissingFeedConfigurationException $e) { |
95 | | - $this->logger->error(sprintf('Missing configuration for feed with id "%s" with message "%s"', $feed->getId()->jsonSerialize(), $e->getMessage())); |
96 | | - } catch (\JsonException $e) { |
97 | | - $this->logger->error(sprintf('JSON decode for feed with id "%s" with error "%s"', $feed->getId()->jsonSerialize(), $e->getMessage())); |
98 | | - } catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface|TransportExceptionInterface $e) { |
| 92 | + } catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $e) { |
99 | 93 | $this->logger->error(sprintf('Communication error "%s"', $e->getMessage())); |
| 94 | + } catch (\Throwable $e) { |
| 95 | + $this->logger->error(sprintf('Feed data error. ID: %s, MESSAGE: %s', $feed->getId()->jsonSerialize(), $e->getMessage())); |
100 | 96 | } |
101 | 97 | } |
102 | 98 |
|
|
0 commit comments