diff --git a/src/app/components/SpaceInvite.svelte b/src/app/components/SpaceInvite.svelte index d748798e..f28c22c7 100644 --- a/src/app/components/SpaceInvite.svelte +++ b/src/app/components/SpaceInvite.svelte @@ -25,6 +25,16 @@ const {url} = $props() const authError = deriveRelayAuthError(url) + let networkError = $state(false) + const isExplicitAuthError = $derived( + $authError && + !( + $authError.toLowerCase().includes("failed") || + $authError.toLowerCase().includes("timeout") || + $authError.toLowerCase().includes("network") + ), + ) + const isGenericError = $derived(networkError || ($authError && !isExplicitAuthError)) const back = () => history.back() const copyInvite = () => clip(invite) @@ -70,8 +80,14 @@ ]) claim = getTagValue("claim", event?.tags || []) || "" - } catch { + } catch (err) { claim = "" + if ( + (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) || + !navigator.onLine + ) { + networkError = true + } } finally { loading = false } @@ -92,7 +108,11 @@
+ Unable to reach the relay. Please check your connection and try again. +
+ {:else if isExplicitAuthError}Oops! It looks like you're not a member of this relay.
{:else}