From 37efa035a2850d81bee9554bf5b4e464ed6d94db Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 24 Aug 2024 16:31:19 +0600 Subject: [PATCH] api/twitter: update no tweet error code --- api/src/processing/services/twitter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/processing/services/twitter.js b/api/src/processing/services/twitter.js index bc253774..d45ff713 100644 --- a/api/src/processing/services/twitter.js +++ b/api/src/processing/services/twitter.js @@ -119,6 +119,10 @@ export default async function({ id, index, toGif, dispatcher }) { let tweetTypename = tweet?.data?.tweetResult?.result?.__typename; + if (!tweetTypename) { + return { error: "fetch.empty" } + } + if (tweetTypename === "TweetUnavailable") { const reason = tweet?.data?.tweetResult?.result?.reason; switch(reason) { @@ -133,10 +137,6 @@ export default async function({ id, index, toGif, dispatcher }) { } } - if (!tweetTypename) { - return { error: "link.invalid" } - } - if (!["Tweet", "TweetWithVisibilityResults"].includes(tweetTypename)) { return { error: "content.post.unavailable" } }