Fix error toast when failing to join room.

This commit is contained in:
mplorentz
2026-04-01 16:38:46 -04:00
parent 823a9c3271
commit e7fd75e06e
2 changed files with 17 additions and 1 deletions
@@ -13,6 +13,7 @@
import ModalSubtitle from "@lib/components/ModalSubtitle.svelte"
import ModalTitle from "@lib/components/ModalTitle.svelte"
import {displayRoom} from "@app/core/state"
import {handleJoinError} from "@app/components/VoiceWidget.svelte"
import {joinVoiceRoom} from "@app/voice"
import {popModal} from "@app/util/modal"
@@ -52,7 +53,7 @@
h,
startWithoutMic,
startWithoutMic ? undefined : selectedDeviceId || undefined,
)
).catch(handleJoinError)
}
</script>
+15
View File
@@ -1,3 +1,18 @@
<script module lang="ts">
import {AbortError, TimeoutError} from "$lib/util"
import {pushToast} from "@app/util/toast"
export function handleJoinError(e: unknown) {
if (e instanceof AbortError) return
console.error("Failed to join voice room", e)
let message = "Failed to join voice room"
if (e instanceof TimeoutError)
message = "Connection timed out. Please check your network and try again."
else if (e instanceof Error) message = e.message
pushToast({theme: "error", message})
}
</script>
<script lang="ts">
import {readable} from "svelte/store"
import {fly} from "svelte/transition"