Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit 76cec58

Browse files
committed
Add logs
1 parent 009bb97 commit 76cec58

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

assets/src/features/streaming/StreamingErrorBoundary.tsx

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { FC, PropsWithChildren, useCallback, useEffect, useState } from "react";
22
import useToast from "../shared/hooks/useToast";
33
import { ErrorMessage, messageComparator } from "../../pages/room/errorMessage";
4-
import { useClient } from "../../fishjam";
4+
import { PeerMetadata, TrackMetadata, useClient } from "../../fishjam";
55
import useEffectOnChange from "../shared/hooks/useEffectOnChange";
6+
import { MessageEvents } from "@fishjam-dev/ts-client";
67

78
export const StreamingErrorBoundary: FC<PropsWithChildren> = ({ children }) => {
89
const { addToast } = useToast();
@@ -23,21 +24,27 @@ export const StreamingErrorBoundary: FC<PropsWithChildren> = ({ children }) => {
2324
useEffect(() => {
2425
if (!client) return;
2526

26-
const onSocketError = (_: Event) => {
27+
const onSocketError: MessageEvents<PeerMetadata, TrackMetadata>["socketError"] = (error: Event) => {
28+
console.warn(error);
2729
handleError(`Socket error occurred.`, "onSocketError");
2830
};
2931

30-
const onConnectionError = (message: string) => {
31-
handleError(`Connection error occurred. ${message ?? ""}`);
32+
const onConnectionError: MessageEvents<PeerMetadata, TrackMetadata>["connectionError"] = (error) => {
33+
console.warn(error);
34+
handleError(`Connection error occurred. ${error?.message ?? ""}`);
3235
};
33-
const onJoinError = (_: unknown) => {
36+
37+
const onJoinError: MessageEvents<PeerMetadata, TrackMetadata>["joinError"] = (event) => {
38+
console.log(event)
3439
handleError(`Failed to join the room`);
3540
};
36-
const onAuthError = () => {
41+
const onAuthError: MessageEvents<PeerMetadata, TrackMetadata>["authError"] = (reason) => {
42+
console.warn(reason);
3743
handleError(`Socket error occurred.`, "onAuthError");
3844
};
3945

40-
const onSocketClose = (_: Event) => {
46+
const onSocketClose: MessageEvents<PeerMetadata, TrackMetadata>["socketClose"] = (event) => {
47+
console.warn(event);
4148
handleError(`Signaling socket closed.`, "onSocketClose");
4249
};
4350

0 commit comments

Comments
 (0)