From 26bc1c8cc8f5c091c3b0f136dd9bae87614d0ac3 Mon Sep 17 00:00:00 2001 From: BentiGorlich Date: Mon, 9 Sep 2024 20:19:53 +0200 Subject: [PATCH] Fix update actor failing because of a serializer error (#1098) --- src/Service/RemoteInstanceManager.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Service/RemoteInstanceManager.php b/src/Service/RemoteInstanceManager.php index 354a819dc..b7f0f353c 100644 --- a/src/Service/RemoteInstanceManager.php +++ b/src/Service/RemoteInstanceManager.php @@ -57,11 +57,18 @@ public function updateInstance(Instance $instance, bool $force = false): bool $nodeInfoRaw = $this->client->fetchInstanceNodeInfo($linkToUse->href, false); $this->logger->debug('got raw nodeinfo for url {url}: {raw}', ['raw' => $nodeInfoRaw, 'url' => $linkToUse]); - /** @var NodeInfo $nodeInfo */ - $nodeInfo = $serializer->deserialize($nodeInfoRaw, NodeInfo::class, 'json'); - - $instance->software = $nodeInfo?->software?->name; - $instance->version = $nodeInfo?->software?->version; + try { + /** @var NodeInfo $nodeInfo */ + $nodeInfo = $serializer->deserialize($nodeInfoRaw, NodeInfo::class, 'json'); + $instance->software = $nodeInfo?->software?->name; + $instance->version = $nodeInfo?->software?->version; + } catch (\Error|\Exception $e) { + $this->logger->warning('There as an exception decoding the nodeinfo from {url}: {e} - {m}', [ + 'url' => $instance->domain, + 'e' => \get_class($e), + 'm' => $e->getMessage(), + ]); + } $instance->setUpdatedAt(); $this->entityManager->persist($instance);