fix/wrong-message-offline #222
Reference in New Issue
Block a user
Delete Branch "DeveshSingh/flotilla:fix/wrong-message-offline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Title
Fix: Differentiate network errors from auth errors in SpaceInvite.svelte
Description
The Problem
When a user attempted to create a space invite while offline or experiencing network connectivity issues, the
SpaceInvite.sveltemodal would incorrectly display the message: "Oops! It looks like you're not a member of this relay."Because
@welshman/net'srequest()resolves silently on network failure rather than throwing an error, the component'scatchblock never executed. Instead, thederiveRelayAuthErrorthunk would fail in the background, surfacing a generic network failure string (e.g."Failed to publish to any relays"or"Timeout"). The template previously treated any truthy$authErrorstring as an authentication rejection, leading to misleading UI feedback.The Solution
Following PR feedback to avoid relying solely on the heuristic
navigator.onLine, this PR updates the component to classify errors directly based on the request's failure string:isExplicitAuthErrorandisGenericErrorderived states. We now parse the$authErrorstring—if it contains keywords indicating a network or signing failure (failed,timeout,network), it is caught and treated as a generic connectivity issue.restricted: ...,forbidden: ...) now correctly display: "Oops! It looks like you're not a member of this relay."Property 'name' does not exist on type '{}'TypeScript error in thecatchblock by implementing a properinstanceof Errortype guard and standardizing checks for both"AbortError"and"TimeoutError".Testing Performed
a4b35d9774to79a4e22cd4