|
@@ -28,6 +28,35 @@ function loadCallStatsAPI() {
|
28
|
28
|
*/
|
29
|
29
|
var LOG_INTERVAL = 60000;
|
30
|
30
|
|
|
31
|
+/**
|
|
32
|
+ * callstats strips any additional fields from Error except for "name", "stack",
|
|
33
|
+ * "message" and "constraintName". So we need to bundle additional information
|
|
34
|
+ * from JitsiTrackError into error passed to callstats to preserve valuable
|
|
35
|
+ * information about error.
|
|
36
|
+ * @param {JitsiTrackError} error
|
|
37
|
+ */
|
|
38
|
+function formatJitsiTrackErrorForCallStats(error) {
|
|
39
|
+ var err = new Error();
|
|
40
|
+
|
|
41
|
+ // Just copy original stack from error
|
|
42
|
+ err.stack = error.stack;
|
|
43
|
+
|
|
44
|
+ // Combine name from error's name plus (possibly) name of original GUM error
|
|
45
|
+ err.name = (error.name || "Unknown error") + (error.gum && error.gum.error
|
|
46
|
+ && error.gum.error.name ? " - " + error.gum.error.name : "");
|
|
47
|
+
|
|
48
|
+ // Put all constraints into this field. For constraint failed errors we will
|
|
49
|
+ // still know which exactly constraint failed as it will be a part of
|
|
50
|
+ // message.
|
|
51
|
+ err.constraintName = error.gum && error.gum.constraints
|
|
52
|
+ ? JSON.stringify(error.gum.constraints) : "";
|
|
53
|
+
|
|
54
|
+ // Just copy error's message.
|
|
55
|
+ err.message = error.message;
|
|
56
|
+
|
|
57
|
+ return err;
|
|
58
|
+}
|
|
59
|
+
|
31
|
60
|
function Statistics(xmpp, options) {
|
32
|
61
|
this.rtpStats = null;
|
33
|
62
|
this.eventEmitter = new EventEmitter();
|