Skip to content

Commit

Permalink
fix: add onicecandidateerror logging for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
k-wasniowski committed Apr 29, 2024
1 parent ab8c6f5 commit 52e3a8e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/peer-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ class PeerConnection extends EventEmitter<PeerConnectionEventHandlers> {
this.pc.onicecandidate = (ev: RTCPeerConnectionIceEvent) => {
this.emit(PeerConnection.Events.IceCandidate, ev);
};

this.pc.onicecandidateerror = (ev: Event) => {
try {
const { url, errorCode, errorText } = ev as RTCPeerConnectionIceErrorEvent;

logger.warn(`ICE Candidate(${url}) error: ${errorCode}, with message: ${errorText}`);
} catch (error) {
logger.error(`Failed to log ICE Candidate error: ${error}`);
}
};
}

/**
Expand Down

0 comments on commit 52e3a8e

Please sign in to comment.