Skip to content

Commit f3adb51

Browse files
committed
cleaned up foolish confusion of JSON.stringify/parse
1 parent 48eafb8 commit f3adb51

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/webrtc/peerconnection.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,6 @@ export class PeerConnectionClass implements PeerConnection<signals.Message> {
389389
if (state === 'have-local-offer') {
390390
return this.pc_.getLocalDescription().then(
391391
(localOffer:freedom_RTCPeerConnection.RTCSessionDescription) => {
392-
// TODO: either specify a functional call requirement that the sdp
393-
// fields are valid JSON, so add a try-catch.
394392
if (djb2.stringHash(JSON.stringify(remoteOffer.sdp)) <
395393
djb2.stringHash(JSON.stringify(localOffer.sdp))) {
396394
// TODO: implement reset and use their offer.
@@ -444,14 +442,8 @@ export class PeerConnectionClass implements PeerConnection<signals.Message> {
444442
this.fromPeerCandidateQueue.setHandler(this.pc_.addIceCandidate);
445443
})
446444
.catch((e) => {
447-
var descriptionString :string
448-
try {
449-
descriptionString = JSON.stringify(description)
450-
} catch(e) {
451-
descriptionString = "[unstringifiable object]"
452-
}
453-
this.closeWithError_('Failed to set remote description: ' + descriptionString
454-
+ '; Error: ' + e.toString());
445+
this.closeWithError_('Failed to set remote description: ' +
446+
JSON.stringify(description) + '; Error: ' + e.toString());
455447
});
456448
}
457449

0 commit comments

Comments
 (0)