Add error toast on connection failure.

This commit is contained in:
mplorentz
2026-03-03 08:41:25 -05:00
parent a9d29771d1
commit 817c2d2e01
2 changed files with 56 additions and 22 deletions
+9 -1
View File
@@ -5,6 +5,7 @@
import SecondaryNavItem from "@lib/components/SecondaryNavItem.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte"
import RoomName from "@app/components/RoomName.svelte"
import {pushToast} from "@app/util/toast"
import {deriveVoiceParticipants, joinVoiceRoom, currentVoiceSession} from "@app/voice"
interface Props {
@@ -17,7 +18,14 @@
const participants = deriveVoiceParticipants(url, h)
const isActive = $derived($currentVoiceSession?.url === url && $currentVoiceSession?.h === h)
const handleClick = () => joinVoiceRoom(url, h)
const handleClick = async () => {
try {
await joinVoiceRoom(url, h)
} catch (e) {
const message = e instanceof Error ? e.message : String(e)
pushToast({theme: "error", message: `Failed to join voice room: ${message}`})
}
}
$effect(() => {
for (const pk of $participants) {