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>
This commit is contained in:
parent
7f3324d4a4
commit
e6bda92b20
9 changed files with 602 additions and 463 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue