Error handling

React

You receive Dyte meeting related errors in the onError callback.

Currently there are 3 types of errors we emit.

DyteErrors {
    CLIENTID_INVALID,
    MEETING_UNAUTHORIZED,
    MEETING_NOTFOUND
}

You can handle them like in the example below.

import { DyteMeeting, DyteErrors } from "@dyte/client";

function App() {
    const onError = (error) => {
        if (error = DyteErrors.MEETING_NOTFOUND) {
            // take appropriate action
        }
    }

    return (
        <div className="App">
            <DyteMeeting
                onInit={(meeting: Meeting) => { }}
                onError={onError}
                clientId={`orgId || clientId`}
                meetingConfig={{
                    roomName: `roomName`,
                    authToken: `authToken`,
                }}
            />
        </div>
    );
}

export default App;

VanillaJS

<div id="root"></div>
<script>
    const client = new DyteClient({ clientId: "orgId|clientId" });

    const meeting = client.Meeting({
        roomName: "<roomName>",
        authToken: "<authToken>"
    });

    meeting.onError((error) => {
        if (error === DyteErrors.MEETING_NOTFOUND) {
            // take appropriate action
        }
    })

    meeting.init("root");
</script>