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:
Eric Bailey 2023-12-05 20:25:32 -06:00 committed by GitHub
parent 7f3324d4a4
commit e6bda92b20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 602 additions and 463 deletions

View file

@ -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,
}
}
},
})