Browse code

manage timeout

Louis Jonget authored on02/05/2025 11:10:31
Showing1 changed files
... ...
@@ -106,8 +106,9 @@ function xhr_to_syno(method, url_path, onload_function, max_retry, timeout) {
106 106
                 } else if (xhr.status == 0) { //timeout
107 107
                     console.log('------xhr timed out');
108 108
                     //send back "timeout" to watch
109
-                    message = "Time out";
110
-                    send_message_to_watch(message)
109
+                    //message = "Time out";
110
+                    //send_message_to_watch(message)
111
+                    onload_function(xhr);
111 112
                 } else { // why would this happen?
112 113
                     console.log('------xhr request returned error code ' + xhr.status);
113 114
                     message = "Error (XHR" + xhr.status + ")";
... ...
@@ -179,6 +180,9 @@ function authenticate(action_callback) {
179 180
                 } else if (response.error.code == 407) {
180 181
                     console.log('------Authentication failed because of IP Blocked');
181 182
                     message = "Authentication failed, IP is blocked";
183
+                }else if (xhr.status == 0){
184
+                    console.log('------Authentication failed because of request timed out');
185
+                    message = "Time out";
182 186
                 }
183 187
                 send_message_to_watch(message)
184 188
             }