]> git.mxchange.org Git - friendica.git/commitdiff
Avoid blank network page on database issues
authorMichael <heluecht@pirati.ca>
Sun, 15 Sep 2024 05:35:30 +0000 (05:35 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 15 Sep 2024 05:35:30 +0000 (05:35 +0000)
src/Module/Conversation/Network.php
src/Module/Update/Network.php

index e79ec5899d80bfdcf624f605cf98f85c790029a1..49a478fbc495db7188cc12c886879e2c367376a5 100644 (file)
@@ -222,7 +222,9 @@ class Network extends Timeline
 
                        $o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $this->getOrder(), $this->session->getLocalUserId());
                } catch (\Exception $e) {
+                       $this->logger->error('Exception when fetching items', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
                        $o .= $this->l10n->t('Error %d (%s) while fetching the timeline.', $e->getCode(), $e->getMessage());
+                       $items = [];
                }
 
                if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll')) {
index 33a81eb0eeb7109cd569994ee3d68711ab7bab92..4c04beecb42b5df010f37679c057aa38a7f3cb75 100644 (file)
@@ -27,12 +27,17 @@ class Network extends NetworkModule
                        System::htmlUpdateExit($o);
                }
 
-               if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
-                       $items = $this->getChannelItems($request, $this->session->getLocalUserId());
-               } elseif ($this->community->isTimeline($this->selectedTab)) {
-                       $items = $this->getCommunityItems();
-               } else {
-                       $items = $this->getItems();
+               try {
+                       if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+                               $items = $this->getChannelItems($request, $this->session->getLocalUserId());
+                       } elseif ($this->community->isTimeline($this->selectedTab)) {
+                               $items = $this->getCommunityItems();
+                       } else {
+                               $items = $this->getItems();
+                       }
+               } catch (\Exception $e) {
+                       $this->logger->error('Exception when fetching items', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
+                       $items = [];
                }
 
                $o = $this->conversation->render($items, Conversation::MODE_NETWORK, true, false, $this->getOrder(), $this->session->getLocalUserId());