videochat debug

This commit is contained in:
Jeff Emmett 2024-12-08 19:57:25 -05:00
parent 3ac37630df
commit 79a86ee4c2
3 changed files with 30 additions and 1 deletions

View File

@ -50,6 +50,17 @@ export default function InteractiveShapeExample() {
//createRoot(document.getElementById("root")!).render(<App />) //createRoot(document.getElementById("root")!).render(<App />)
function App() { function App() {
if (process.env.NODE_ENV === "production") {
// Disable all console logs in production
console.log = () => {}
console.debug = () => {}
console.info = () => {}
// Keep error and warn for debugging
// console.error = () => {};
// console.warn = () => {};
}
return ( return (
<BrowserRouter> <BrowserRouter>
<Routes> <Routes>

View File

@ -3,6 +3,12 @@ import { useEffect, useState, useRef } from "react"
import { WORKER_URL } from "../routes/Board" import { WORKER_URL } from "../routes/Board"
import DailyIframe from "@daily-co/daily-js" import DailyIframe from "@daily-co/daily-js"
interface Window {
DailyIframe: {
setLogLevel(level: "error" | "warn" | "info" | "debug"): void
}
}
export type IVideoChatShape = TLBaseShape< export type IVideoChatShape = TLBaseShape<
"VideoChat", "VideoChat",
{ {
@ -160,6 +166,13 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
.finally(() => setIsLoading(false)) .finally(() => setIsLoading(false))
}, []) }, [])
// useEffect(() => {
// // Disable Daily.co debug logs
// if (window.DailyIframe) {
// window.DailyIframe.setLogLevel("error")
// }
// }, [])
if (isLoading) { if (isLoading) {
return ( return (
<div <div

View File

@ -75,7 +75,12 @@ const router = AutoRouter<IRequest, [env: Environment, ctx: ExecutionContext]>({
return corsify(response) return corsify(response)
}, },
], ],
catch: (e) => { catch: (e: Error) => {
// Silently handle WebSocket errors, but log other errors
if (e.message?.includes("WebSocket")) {
console.debug("WebSocket error:", e)
return new Response(null, { status: 400 })
}
console.error(e) console.error(e)
return error(e) return error(e)
}, },