about summary refs log tree commit diff
path: root/src/view/com/posts/FeedErrorMessage.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-12-04 15:27:48 -0600
committerGitHub <noreply@github.com>2023-12-04 13:27:48 -0800
commit094a58490f05205a1def8d992672c1deb51a14a8 (patch)
treea8a29f10e23aff6fe353af16d4c8e8a6e6f7c2d9 /src/view/com/posts/FeedErrorMessage.tsx
parent37cafb080bb7a2892d20a991a49953c08dbe2763 (diff)
downloadvoidsky-094a58490f05205a1def8d992672c1deb51a14a8.tar.zst
Handle feedgen 429 (#2066)
* Handle feedgen 429

* Translate
Diffstat (limited to 'src/view/com/posts/FeedErrorMessage.tsx')
-rw-r--r--src/view/com/posts/FeedErrorMessage.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/view/com/posts/FeedErrorMessage.tsx b/src/view/com/posts/FeedErrorMessage.tsx
index 63d9d5956..f63bc1a88 100644
--- a/src/view/com/posts/FeedErrorMessage.tsx
+++ b/src/view/com/posts/FeedErrorMessage.tsx
@@ -25,6 +25,7 @@ export enum KnownError {
   FeedgenOffline = 'FeedgenOffline',
   FeedgenUnknown = 'FeedgenUnknown',
   FeedNSFPublic = 'FeedNSFPublic',
+  FeedTooManyRequests = 'FeedTooManyRequests',
   Unknown = 'Unknown',
 }
 
@@ -100,6 +101,9 @@ function FeedgenErrorMessage({
         [KnownError.FeedgenUnknown]: _l(
           msgLingui`Hmm, some kind of issue occured when contacting the feed server. Please let the feed owner know about this issue.`,
         ),
+        [KnownError.FeedTooManyRequests]: _l(
+          msgLingui`We're sorry, but this feed is currently receiving high traffic and is temporarily unavailable. Please try again later.`,
+        ),
       }[knownError]),
     [_l, knownError],
   )
@@ -203,6 +207,13 @@ function detectKnownError(
   ) {
     return KnownError.Block
   }
+
+  // check status codes
+  if (error?.status === 429) {
+    return KnownError.FeedTooManyRequests
+  }
+
+  // convert error to string and continue
   if (typeof error !== 'string') {
     error = error.toString()
   }