From 519d51504861218973157660334f881c5dfa1551 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 22 Apr 2020 14:18:55 -0700 Subject: [PATCH] improve webrtc error messages (Fix Error: [object RTCErrorEvent]) --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8cffb373..5d0d08b7 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,8 @@ function filterTrickle (sdp) { return sdp.replace(/a=ice-options:trickle\s\n/g, '') } -function makeError (message, code) { - var err = new Error(message) +function makeError (err, code) { + if (!(err instanceof Error)) err = new Error(err) err.code = code return err }