···11import React, {useCallback, useEffect, useRef} from 'react'
22import {AppState} from 'react-native'
33-import {AppBskyFeedDefs, AppBskyFeedPost, PostModeration} from '@atproto/api'
33+import {
44+ AppBskyFeedDefs,
55+ AppBskyFeedPost,
66+ AtUri,
77+ PostModeration,
88+} from '@atproto/api'
49import {
510 useInfiniteQuery,
611 InfiniteData,
···2934import {embedViewRecordToPostView, getEmbeddedPost} from './util'
3035import {useModerationOpts} from './preferences'
3136import {queryClient} from 'lib/react-query'
3737+import {BSKY_FEED_OWNER_DIDS} from 'lib/constants'
32383339type ActorDid = string
3440type AuthorFilter =
···137143 cursor: undefined,
138144 }
139145140140- const res = await api.fetch({cursor, limit: PAGE_SIZE})
141141- precacheFeedPostProfiles(queryClient, res.feed)
146146+ try {
147147+ const res = await api.fetch({cursor, limit: PAGE_SIZE})
148148+ precacheFeedPostProfiles(queryClient, res.feed)
149149+150150+ /*
151151+ * If this is a public view, we need to check if posts fail moderation.
152152+ * If all fail, we throw an error. If only some fail, we continue and let
153153+ * moderations happen later, which results in some posts being shown and
154154+ * some not.
155155+ */
156156+ if (!getAgent().session) {
157157+ assertSomePostsPassModeration(res.feed)
158158+ }
159159+160160+ return {
161161+ api,
162162+ cursor: res.cursor,
163163+ feed: res.feed,
164164+ fetchedAt: Date.now(),
165165+ }
166166+ } catch (e) {
167167+ const feedDescParts = feedDesc.split('|')
168168+ const feedOwnerDid = new AtUri(feedDescParts[1]).hostname
142169143143- /*
144144- * If this is a public view, we need to check if posts fail moderation.
145145- * If all fail, we throw an error. If only some fail, we continue and let
146146- * moderations happen later, which results in some posts being shown and
147147- * some not.
148148- */
149149- if (!getAgent().session) {
150150- assertSomePostsPassModeration(res.feed)
151151- }
170170+ if (
171171+ feedDescParts[0] === 'feedgen' &&
172172+ BSKY_FEED_OWNER_DIDS.includes(feedOwnerDid)
173173+ ) {
174174+ logger.error(`Bluesky feed may be offline: ${feedOwnerDid}`, {
175175+ feedDesc,
176176+ jsError: e,
177177+ })
178178+ }
152179153153- return {
154154- api,
155155- cursor: res.cursor,
156156- feed: res.feed,
157157- fetchedAt: Date.now(),
180180+ throw e
158181 }
159182 },
160183 initialPageParam: undefined,