瀏覽代碼

No longer log Strophe's secondary timeouts as errors

tags/v0.0.2
paweldomas 9 年之前
父節點
當前提交
dbc3368c6b
共有 1 個檔案被更改,包括 10 行新增0 行删除
  1. 10
    0
      modules/xmpp/strophe.util.js

+ 10
- 0
modules/xmpp/strophe.util.js 查看文件

@@ -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…
取消
儲存