diff options
author | Eric Bailey <git@esb.lol> | 2023-12-05 20:25:32 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 18:25:32 -0800 |
commit | e6bda92b206de0d839c4e134d25fc7f56ae9c767 (patch) | |
tree | d52a979583406c6b373aec28fed31333c99ec787 /src/state/queries/feed.ts | |
parent | 7f3324d4a4499ed644074b0cb68d68b2dac8ab86 (diff) | |
download | voidsky-e6bda92b206de0d839c4e134d25fc7f56ae9c767.tar.zst |
Surface raw server error if exists (#2096)
* Surface raw server error if exists * Update copy * Update translation files --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/state/queries/feed.ts')
-rw-r--r-- | src/state/queries/feed.ts | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index 9a0ff1eaf..75aac5cdb 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -175,7 +175,10 @@ export function useIsFeedPublicQuery({uri}: {uri: string}) { feed: uri, limit: 1, }) - return Boolean(res.data.feed) + return { + isPublic: Boolean(res.data.feed), + error: undefined, + } } catch (e: any) { /** * This should be an `XRPCError`, but I can't safely import from @@ -184,10 +187,19 @@ export function useIsFeedPublicQuery({uri}: {uri: string}) { * @see https://github.com/bluesky-social/atproto/blob/c17971a2d8e424cc7f10c071d97c07c08aa319cf/packages/xrpc/src/client.ts#L126 */ if (e?.status === 401) { - return false + return { + isPublic: false, + error: e, + } } - return true + /* + * Non-401 response means something else went wrong on the server + */ + return { + isPublic: true, + error: e, + } } }, }) |