Browse Source

No longer log Strophe's secondary timeouts as errors

tags/v0.0.2
paweldomas 9 years ago
parent
commit
dbc3368c6b
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      modules/xmpp/strophe.util.js

+ 10
- 0
modules/xmpp/strophe.util.js View File

@@ -8,6 +8,16 @@ var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
8 8
 module.exports = function () {
9 9
 
10 10
     Strophe.log = function (level, msg) {
11
+        // Our global handler reports uncaught errors to the stats which may
12
+        // interpret those as partial call failure.
13
+        // Strophe log entry about secondary request timeout does not mean that
14
+        // it's a final failure(the request will be restarted), so we lower it's
15
+        // level here to a warning.
16
+        if (typeof msg === 'string' &&
17
+                msg.indexOf("Request ") !== -1 &&
18
+                msg.indexOf("timed out (secondary), restarting") !== -1) {
19
+            level = Strophe.LogLevel.WARN;
20
+        }
11 21
         switch (level) {
12 22
             case Strophe.LogLevel.WARN:
13 23
                 logger.warn("Strophe: " + msg);

Loading…
Cancel
Save